From 6e588f6dcfcffa24decf418b96b4184a907d2bf8 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Sun, 9 Dec 2007 20:11:15 +0100 Subject: kconfig: if ncurses-devel is missing then say so With this patch when ncurses-devel (or whatever it is named) is missing trying to run menuconfig will result in this: $ make menuconfig HOSTCC scripts/kconfig/conf.o HOSTCC scripts/kconfig/kxgettext.o *** Unable to find the ncurses libraries or the *** required header files. *** 'make menuconfig' requires the ncurses libraries. *** *** Install ncurses (ncurses-devel) and try again. *** make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1 make: *** [menuconfig] Error 2 Much better than before where we just listed some build errors. The other *config targets will work indepenednt on ncurses being present or not. Includes improvements suggested by: Frans Pop Signed-off-by: Sam Ravnborg Cc: Frans Pop --- scripts/kconfig/Makefile | 14 ++++++++------ scripts/kconfig/lxdialog/check-lxdialog.sh | 16 +++++++++------- 2 files changed, 17 insertions(+), 13 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 1ad6f7fc490a..80914358817e 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -93,12 +93,6 @@ HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) HOST_EXTRACFLAGS += -DLOCALE -PHONY += $(obj)/dochecklxdialog -$(obj)/dochecklxdialog: - $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_LOADLIBES) - -always := dochecklxdialog - # =========================================================================== # Shared Makefile for the various kconfig executables: @@ -145,6 +139,14 @@ clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c clean-files += mconf qconf gconf +# Check that we have the required ncurses stuff installed for lxdialog (menuconfig) +PHONY += $(obj)/dochecklxdialog +$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog +$(obj)/dochecklxdialog: + $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES) + +always := dochecklxdialog + # Add environment specific flags HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh index 9681476b96e7..62e1e02126e6 100644 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh @@ -36,14 +36,16 @@ trap "rm -f $tmp" 0 1 2 3 15 # Check if we can link to ncurses check() { - echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null + echo -e " #include CURSES_LOC \n main() {}" | + $cc -xc - -o $tmp 2> /dev/null if [ $? != 0 ]; then - echo " *** Unable to find the ncurses libraries." 1>&2 - echo " *** make menuconfig require the ncurses libraries" 1>&2 - echo " *** " 1>&2 - echo " *** Install ncurses (ncurses-devel) and try again" 1>&2 - echo " *** " 1>&2 - exit 1 + echo " *** Unable to find the ncurses libraries or the" 1>&2 + echo " *** required header files." 1>&2 + echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2 + echo " *** " 1>&2 + echo " *** Install ncurses (ncurses-devel) and try again." 1>&2 + echo " *** " 1>&2 + exit 1 fi } -- cgit v1.2.3 From 2f4b489b77c68b9cba1bd9dec5a1bbf0ab3c47f8 Mon Sep 17 00:00:00 2001 From: Andres Salomon Date: Mon, 17 Dec 2007 01:34:58 -0500 Subject: kconfig: use getopt() in conf.c for handling command line arguments Switch from doing our own parsing of command line arguments to using getopt(3) to do it. Aside from simplifying things, this allows us to specify multiple arguments; the old code could only accept two arguments (input_mode and kconfig name). Note some subtle changes: - The argument '-?' is no longer supported. - '-h' is not treated as an error, so output goes to stdout, and we exit with '0'. - There is no compatibility checking amongst arguments; the last option will simply override earlier options. For example, 'conf -n -y foo' is perfectly valid now (input_mode will be set_yes). Previously, that would have been an error ("can't find file -y"). Signed-off-by: Andres Salomon Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/conf.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 8d6f17490c5e..d4737d35e720 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -495,12 +495,12 @@ static void check_conf(struct menu *menu) int main(int ac, char **av) { - int i = 1; + int opt; const char *name; struct stat tmpstat; - if (ac > i && av[i][0] == '-') { - switch (av[i++][1]) { + while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) { + switch (opt) { case 'o': input_mode = ask_new; break; @@ -513,12 +513,7 @@ int main(int ac, char **av) break; case 'D': input_mode = set_default; - defconfig_file = av[i++]; - if (!defconfig_file) { - printf(_("%s: No default config file specified\n"), - av[0]); - exit(1); - } + defconfig_file = optarg; break; case 'n': input_mode = set_no; @@ -534,16 +529,19 @@ int main(int ac, char **av) srandom(time(NULL)); break; case 'h': - case '?': - fprintf(stderr, "See README for usage info\n"); + printf("See README for usage info\n"); exit(0); + break; + default: + fprintf(stderr, "See README for usage info\n"); + exit(1); } } - name = av[i]; - if (!name) { + if (ac == optind) { printf(_("%s: Kconfig file missing\n"), av[0]); exit(1); } + name = av[optind]; conf_parse(name); //zconfdump(stdout); switch (input_mode) { -- cgit v1.2.3 From 09af091f50409a60a72086c737b9a6224dde5ab8 Mon Sep 17 00:00:00 2001 From: Ladislav Michl Date: Mon, 17 Dec 2007 19:07:41 +0100 Subject: kconfig: make kconfig MinGW friendly Kconfig is powerfull tool. So powerfull that more and more software projects are using it for configuration. So instead of fixing some of them one by one, lets fix it in kernel and wait for sync. This work was originaly done for PTXdist - GPL licensed build system for userlands and cross-compilers, but it will not hurt kernel kconfig either. PTXdist menuconfig now works on Windows linked with PDCurses and compiled using MinGW - there is no termios and signals. * Do not include and (comes from times when lxdialog was separate process) * Do not mess with termios directly and let curses tell screen size. Comment to commit c8dc68ad0fbd934e78e913b8a8d7b45945db4930 says check for screen size could be removed later, but because it didn't happen for more than year I left it here as well. * Save cursor position added by Sam Signed-off-by: Ladislav Michl Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/lxdialog/dialog.h | 5 ++-- scripts/kconfig/lxdialog/util.c | 32 +++++++++++++------- scripts/kconfig/mconf.c | 61 ++++++--------------------------------- 3 files changed, 32 insertions(+), 66 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index 7e17eba75ae8..c4ad37fd922c 100644 --- a/scripts/kconfig/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h @@ -187,10 +187,9 @@ int item_is_tag(char tag); int on_key_esc(WINDOW *win); int on_key_resize(void); -void init_dialog(const char *backtitle); +int init_dialog(const char *backtitle); void set_dialog_backtitle(const char *backtitle); -void reset_dialog(void); -void end_dialog(void); +void end_dialog(int x, int y); void attr_clear(WINDOW * win, int height, int width, chtype attr); void dialog_clear(void); void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x); diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c index a1bddefe73d0..86d95cca46a7 100644 --- a/scripts/kconfig/lxdialog/util.c +++ b/scripts/kconfig/lxdialog/util.c @@ -266,31 +266,41 @@ void dialog_clear(void) /* * Do some initialization for dialog */ -void init_dialog(const char *backtitle) +int init_dialog(const char *backtitle) { - dlg.backtitle = backtitle; - color_setup(getenv("MENUCONFIG_COLOR")); -} + int height, width; + + initscr(); /* Init curses */ + getmaxyx(stdscr, height, width); + if (height < 19 || width < 80) { + endwin(); + return -ERRDISPLAYTOOSMALL; + } -void set_dialog_backtitle(const char *backtitle) -{ dlg.backtitle = backtitle; -} + color_setup(getenv("MENUCONFIG_COLOR")); -void reset_dialog(void) -{ - initscr(); /* Init curses */ keypad(stdscr, TRUE); cbreak(); noecho(); dialog_clear(); + + return 0; +} + +void set_dialog_backtitle(const char *backtitle) +{ + dlg.backtitle = backtitle; } /* * End using dialog functions. */ -void end_dialog(void) +void end_dialog(int x, int y) { + /* move cursor back to original position */ + move(y, x); + refresh(); endwin(); } diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 47e226fdedd7..ee9ed3059472 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -8,17 +8,13 @@ * i18n, 2005, Arnaldo Carvalho de Melo */ -#include -#include #include #include #include #include -#include #include #include #include -#include #include #include @@ -275,8 +271,6 @@ search_help[] = N_( "\n"); static int indent; -static struct termios ios_org; -static int rows = 0, cols = 0; static struct menu *current_menu; static int child_count; static int single_menu_mode; @@ -290,41 +284,6 @@ static void show_textbox(const char *title, const char *text, int r, int c); static void show_helptext(const char *title, const char *text); static void show_help(struct menu *menu); -static void init_wsize(void) -{ - struct winsize ws; - char *env; - - if (!ioctl(STDIN_FILENO, TIOCGWINSZ, &ws)) { - rows = ws.ws_row; - cols = ws.ws_col; - } - - if (!rows) { - env = getenv("LINES"); - if (env) - rows = atoi(env); - if (!rows) - rows = 24; - } - if (!cols) { - env = getenv("COLUMNS"); - if (env) - cols = atoi(env); - if (!cols) - cols = 80; - } - - if (rows < 19 || cols < 80) { - fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); - fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); - exit(1); - } - - rows -= 4; - cols -= 5; -} - static void get_prompt_str(struct gstr *r, struct property *prop) { int i, j; @@ -900,13 +859,9 @@ static void conf_save(void) } } -static void conf_cleanup(void) -{ - tcsetattr(1, TCSAFLUSH, &ios_org); -} - int main(int ac, char **av) { + int saved_x, saved_y; char *mode; int res; @@ -923,11 +878,13 @@ int main(int ac, char **av) single_menu_mode = 1; } - tcgetattr(1, &ios_org); - atexit(conf_cleanup); - init_wsize(); - reset_dialog(); - init_dialog(NULL); + getyx(stdscr, saved_y, saved_x); + if (init_dialog(NULL)) { + fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); + fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); + return 1; + } + set_config_filename(conf_get_configname()); do { conf(&rootmenu); @@ -941,7 +898,7 @@ int main(int ac, char **av) else res = -1; } while (res == KEY_ESC); - end_dialog(); + end_dialog(saved_x, saved_y); switch (res) { case 0: -- cgit v1.2.3 From d84876f9f8042d5536050b83674c4f348ca3c4df Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 3 Jan 2008 23:33:44 +0100 Subject: kconfig: allow overriding symbols Allow config variables in .config to override earlier ones in the same file. In other words, # CONFIG_SECURITY is not defined CONFIG_SECURITY=y will activate it. This makes it a bit easier to do cat original-config myconfig myconfig2 ... >.config; and run *config as expected. Signed-off-by: Jan Engelhardt Signed-off-by: Sam Ravnborg Cc: Roman Zippel Cc: Randy Dunlap --- scripts/kconfig/confdata.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index e0f402f3b75d..2eccefb03a93 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -232,8 +232,7 @@ load: sym->type = S_BOOLEAN; } if (sym->flags & def_flags) { - conf_warning("trying to reassign symbol %s", sym->name); - break; + conf_warning("override: reassigning to symbol %s", sym->name); } switch (sym->type) { case S_BOOLEAN: @@ -272,8 +271,7 @@ load: sym->type = S_OTHER; } if (sym->flags & def_flags) { - conf_warning("trying to reassign symbol %s", sym->name); - break; + conf_warning("override: reassigning to symbol %s", sym->name); } if (conf_set_sym_val(sym, def, def_flags, p)) continue; @@ -297,11 +295,9 @@ load: } break; case yes: - if (cs->def[def].tri != no) { - conf_warning("%s creates inconsistent choice state", sym->name); - cs->flags &= ~def_flags; - } else - cs->def[def].val = sym; + if (cs->def[def].tri != no) + conf_warning("override: %s changes choice state", sym->name); + cs->def[def].val = sym; break; } cs->def[def].tri = E_OR(cs->def[def].tri, sym->def[def].tri); -- cgit v1.2.3 From d6ee35764f270c699e165b15dc59f4e55546bfda Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 7 Jan 2008 21:09:55 +0100 Subject: kconfig: rename E_OR & friends to avoid name clash We had macros named the same as a set of enumeration values. It is legal code but very confusing to read - so rename the macros from E_* to EXPR_* Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/confdata.c | 2 +- scripts/kconfig/expr.c | 6 +++--- scripts/kconfig/expr.h | 6 +++--- scripts/kconfig/symbol.c | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 2eccefb03a93..497a19e85a07 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -300,7 +300,7 @@ load: cs->def[def].val = sym; break; } - cs->def[def].tri = E_OR(cs->def[def].tri, sym->def[def].tri); + cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri); } } fclose(in); diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 6f98dbfe70cf..c8793d1d908f 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -955,14 +955,14 @@ tristate expr_calc_value(struct expr *e) case E_AND: val1 = expr_calc_value(e->left.expr); val2 = expr_calc_value(e->right.expr); - return E_AND(val1, val2); + return EXPR_AND(val1, val2); case E_OR: val1 = expr_calc_value(e->left.expr); val2 = expr_calc_value(e->right.expr); - return E_OR(val1, val2); + return EXPR_OR(val1, val2); case E_NOT: val1 = expr_calc_value(e->left.expr); - return E_NOT(val1); + return EXPR_NOT(val1); case E_EQUAL: sym_calc_value(e->left.sym); sym_calc_value(e->right.sym); diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index a195986eec6f..b7889971e42d 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -45,9 +45,9 @@ struct expr { union expr_data left, right; }; -#define E_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2)) -#define E_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2)) -#define E_NOT(dep) (2-(dep)) +#define EXPR_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2)) +#define EXPR_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2)) +#define EXPR_NOT(dep) (2-(dep)) struct expr_value { struct expr *expr; diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index c35dcc5d6189..add068c8e513 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -199,7 +199,7 @@ static void sym_calc_visibility(struct symbol *sym) tri = no; for_all_prompts(sym, prop) { prop->visible.tri = expr_calc_value(prop->visible.expr); - tri = E_OR(tri, prop->visible.tri); + tri = EXPR_OR(tri, prop->visible.tri); } if (tri == mod && (sym->type != S_TRISTATE || modules_val == no)) tri = yes; @@ -303,7 +303,7 @@ void sym_calc_value(struct symbol *sym) if (sym_is_choice_value(sym) && sym->visible == yes) { prop = sym_get_choice_prop(sym); newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no; - } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) { + } else if (EXPR_OR(sym->visible, sym->rev_dep.tri) != no) { sym->flags |= SYMBOL_WRITE; if (sym_has_value(sym)) newval.tri = sym->def[S_DEF_USER].tri; @@ -312,7 +312,7 @@ void sym_calc_value(struct symbol *sym) if (prop) newval.tri = expr_calc_value(prop->expr); } - newval.tri = E_OR(E_AND(newval.tri, sym->visible), sym->rev_dep.tri); + newval.tri = EXPR_OR(EXPR_AND(newval.tri, sym->visible), sym->rev_dep.tri); } else if (!sym_is_choice(sym)) { prop = sym_get_default_prop(sym); if (prop) { -- cgit v1.2.3 From de83cf148aaefac8a538a076f2c3c4f33968e04a Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 7 Jan 2008 21:13:04 +0100 Subject: kconfig: delete unused FILE_ and SYMBOL_ flags The *_PRINTED flags were never used - so delete them. Do we need them later then we can re-add them. Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/expr.h | 2 -- scripts/kconfig/gconf.c | 2 -- 2 files changed, 4 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index b7889971e42d..1ee8b1642d3b 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h @@ -25,7 +25,6 @@ struct file { #define FILE_BUSY 0x0001 #define FILE_SCANNED 0x0002 -#define FILE_PRINTED 0x0004 typedef enum tristate { no, mod, yes @@ -86,7 +85,6 @@ struct symbol { #define SYMBOL_CHECK 0x0008 #define SYMBOL_CHOICE 0x0010 #define SYMBOL_CHOICEVAL 0x0020 -#define SYMBOL_PRINTED 0x0040 #define SYMBOL_VALID 0x0080 #define SYMBOL_OPTIONAL 0x0100 #define SYMBOL_WRITE 0x0200 diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index 262908cfc2ac..df910cbab2c0 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c @@ -119,8 +119,6 @@ const char *dbg_print_flags(int val) strcat(buf, "choice/"); if (val & SYMBOL_CHOICEVAL) strcat(buf, "choiceval/"); - if (val & SYMBOL_PRINTED) - strcat(buf, "printed/"); if (val & SYMBOL_VALID) strcat(buf, "valid/"); if (val & SYMBOL_OPTIONAL) -- cgit v1.2.3 From 75ff4309cdb1d7303750aeed07a5d80382fe2e71 Mon Sep 17 00:00:00 2001 From: Ladislav Michl Date: Wed, 9 Jan 2008 16:36:19 +0100 Subject: kconfig: fix whitespace and sort includes in conf.c Sort includes and remove leading whitespace. Signed-off-by: Ladislav Michl Signed-off-by: Sam Ravnborg Cc: Roman Zippel -#include #include +#include #include -#include #include +#include #include #define LKC_DIRECT_LINK @@ -160,7 +160,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) } case set_random: do { - val = (tristate)(random() % 3); + val = (tristate)(rand() % 3); } while (!sym_tristate_within_range(sym, val)); switch (val) { case no: line[0] = 'n'; break; -- cgit v1.2.3 From 07f766885879a1fd4502fb8dd531d1fe3c575510 Mon Sep 17 00:00:00 2001 From: Ladislav Michl Date: Wed, 9 Jan 2008 16:36:19 +0100 Subject: kconfig: use C89 random functions in conf.c rand and srand functions conform also to C89 in addition to POSIX.1-2001, which makes them a bit more portable (work also on MinGW host). Linux man page also says: "The versions of rand() and srand() in the Linux C Library use the same random number generator as random() and srandom()". * Use C89 conformant functions rand() and srand() Signed-off-by: Ladislav Michl Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index a3d2d0b564f4..01c2f3505f5d 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -375,7 +375,7 @@ static int conf_choice(struct menu *menu) break; case set_random: if (is_new) - def = (random() % cnt) + 1; + def = (rand() % cnt) + 1; case set_default: case set_yes: case set_mod: @@ -526,7 +526,7 @@ int main(int ac, char **av) break; case 'r': input_mode = set_random; - srandom(time(NULL)); + srand(time(NULL)); break; case 'h': printf("See README for usage info\n"); -- cgit v1.2.3 From 1020026f99069976001816b8198bc04ee342cd2e Mon Sep 17 00:00:00 2001 From: EGRY Gabor Date: Fri, 11 Jan 2008 23:40:00 +0100 Subject: kconfig: update-po-config info This patch adds tracking messages. Signed-off-by: Egry Gabor Reviewed-by: Sam Ravnborg Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/Makefile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 80914358817e..d28bf8550171 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -24,22 +24,25 @@ oldconfig: $(obj)/conf silentoldconfig: $(obj)/conf $< -s $(Kconfig) -# Create new linux.po file +# Create new linux.pot file # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files # The symlink is used to repair a deficiency in arch/um update-po-config: $(obj)/kxgettext - xgettext --default-domain=linux \ + $(Q)echo " GEN config" + $(Q)xgettext --default-domain=linux \ --add-comments --keyword=_ --keyword=N_ \ --from-code=UTF-8 \ --files-from=scripts/kconfig/POTFILES.in \ --output $(obj)/config.pot $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot $(Q)ln -fs Kconfig.i386 arch/um/Kconfig.arch - (for i in `ls arch/`; \ - do \ - $(obj)/kxgettext arch/$$i/Kconfig; \ - done ) >> $(obj)/config.pot - msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ + $(Q)(for i in `ls arch/`; \ + do \ + echo " GEN $$i"; \ + $(obj)/kxgettext arch/$$i/Kconfig \ + >> $(obj)/config.pot; \ + done ) + $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ --output $(obj)/linux.pot $(Q)rm -f arch/um/Kconfig.arch $(Q)rm -f $(obj)/config.pot @@ -138,6 +141,7 @@ endif clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c clean-files += mconf qconf gconf +clean-files += config.pot linux.pot # Check that we have the required ncurses stuff installed for lxdialog (menuconfig) PHONY += $(obj)/dochecklxdialog -- cgit v1.2.3 From f7a4b4cdc26846a0ac5b3023cb1b97dc632dfd35 Mon Sep 17 00:00:00 2001 From: EGRY Gabor Date: Fri, 11 Jan 2008 23:55:20 +0100 Subject: kconfig: whitespace removing This patch removes the unnecessary whitespaces from end of help lines of Kconfig files. Signed-off-by: Egry Gabor Reviewed-by: Sam Ravnborg Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/lex.zconf.c_shipped | 5 +++++ scripts/kconfig/zconf.l | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped index a065d5a57c01..bed0f4e2d2f7 100644 --- a/scripts/kconfig/lex.zconf.c_shipped +++ b/scripts/kconfig/lex.zconf.c_shipped @@ -1275,6 +1275,11 @@ YY_RULE_SETUP case 32: YY_RULE_SETUP { + while (zconfleng) { + if ((zconftext[zconfleng-1] != ' ') && (zconftext[zconfleng-1] != '\t')) + break; + zconfleng--; + } append_string(zconftext, zconfleng); if (!first_ts) first_ts = last_ts; diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 187d38ccadd5..4cea5c85cd0a 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -217,6 +217,11 @@ n [A-Za-z0-9_] append_string("\n", 1); } [^ \t\n].* { + while (yyleng) { + if ((yytext[yyleng-1] != ' ') && (yytext[yyleng-1] != '\t')) + break; + yyleng--; + } append_string(yytext, yyleng); if (!first_ts) first_ts = last_ts; -- cgit v1.2.3 From bb7ef3905adce28db31933ae77e5397c0b89227a Mon Sep 17 00:00:00 2001 From: EGRY Gabor Date: Fri, 11 Jan 2008 23:47:58 +0100 Subject: kconfig: missing macros in gconfig This patch adds missing gettext macros. Signed-off-by: Egry Gabor Reviewed-by: Sam Ravnborg Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/gconf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index df910cbab2c0..dfe748c38b72 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c @@ -455,11 +455,15 @@ static void text_insert_help(struct menu *menu) { GtkTextBuffer *buffer; GtkTextIter start, end; - const char *prompt = menu_get_prompt(menu); + const char *prompt = _(menu_get_prompt(menu)); gchar *name; const char *help; - help = _(menu_get_help(menu)); + help = menu_get_help(menu); + + /* Gettextize if the help text not empty */ + if ((help != 0) && (help[0] != 0)) + help = _(help); if (menu->sym && menu->sym->name) name = g_strdup_printf(_(menu->sym->name)); @@ -1169,7 +1173,7 @@ static gchar **fill_row(struct menu *menu) bzero(row, sizeof(row)); row[COL_OPTION] = - g_strdup_printf("%s %s", menu_get_prompt(menu), + g_strdup_printf("%s %s", _(menu_get_prompt(menu)), sym && sym_has_value(sym) ? "(NEW)" : ""); if (show_all && !menu_is_visible(menu)) @@ -1219,7 +1223,7 @@ static gchar **fill_row(struct menu *menu) if (def_menu) row[COL_VALUE] = - g_strdup(menu_get_prompt(def_menu)); + g_strdup(_(menu_get_prompt(def_menu))); } if (sym->flags & SYMBOL_CHOICEVAL) row[COL_BTNRAD] = GINT_TO_POINTER(TRUE); -- cgit v1.2.3 From 46d2631978c05e55b28454ac864aba0287f50322 Mon Sep 17 00:00:00 2001 From: EGRY Gabor Date: Fri, 11 Jan 2008 23:46:11 +0100 Subject: kconfig: gettext support for gconfig Gettext support for menu and toolbar. Signed-off-by: Egry Gabor Reviewed-by: Sam Ravnborg Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/Makefile | 7 +++++-- scripts/kconfig/POTFILES.in | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index d28bf8550171..32e8c5a227c3 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -27,7 +27,7 @@ silentoldconfig: $(obj)/conf # Create new linux.pot file # Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files # The symlink is used to repair a deficiency in arch/um -update-po-config: $(obj)/kxgettext +update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h $(Q)echo " GEN config" $(Q)xgettext --default-domain=linux \ --add-comments --keyword=_ --keyword=N_ \ @@ -139,7 +139,7 @@ gconf-objs := gconf.o kconfig_load.o zconf.tab.o endif clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ - .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c + .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h clean-files += mconf qconf gconf clean-files += config.pot linux.pot @@ -254,6 +254,9 @@ $(obj)/%.moc: $(src)/%.h $(obj)/lkc_defs.h: $(src)/lkc_proto.h sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' +# Extract gconf menu items for I18N support +$(obj)/gconf.glade.h: $(obj)/gconf.glade + intltool-extract --type=gettext/glade $(obj)/gconf.glade ### # The following requires flex/bison/gperf diff --git a/scripts/kconfig/POTFILES.in b/scripts/kconfig/POTFILES.in index cc94e46a79e8..19d0e63fb7ba 100644 --- a/scripts/kconfig/POTFILES.in +++ b/scripts/kconfig/POTFILES.in @@ -2,4 +2,5 @@ scripts/kconfig/mconf.c scripts/kconfig/conf.c scripts/kconfig/confdata.c scripts/kconfig/gconf.c +scripts/kconfig/gconf.glade.h scripts/kconfig/qconf.cc -- cgit v1.2.3 From 01771b0fef0f2cbff80e19295394ece2be1ab661 Mon Sep 17 00:00:00 2001 From: EGRY Gabor Date: Fri, 11 Jan 2008 23:53:43 +0100 Subject: kconfig: macro fix in menu.c This patch removes the indirect I18N support for config file. Signed-off-by: Egry Gabor Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index f9d0d91a3fe4..e9deebe22eed 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -394,9 +394,9 @@ bool menu_is_visible(struct menu *menu) const char *menu_get_prompt(struct menu *menu) { if (menu->prompt) - return _(menu->prompt->text); + return menu->prompt->text; else if (menu->sym) - return _(menu->sym->name); + return menu->sym->name; return NULL; } -- cgit v1.2.3 From c21a2d9589faa5599c9876bf0e0f48e81ee90284 Mon Sep 17 00:00:00 2001 From: EGRY Gabor Date: Fri, 11 Jan 2008 23:52:07 +0100 Subject: kconfig: gettext support for xconfig Full gettext support for xconfig. Signed-off-by: Egry Gabor Reviewed-by: Sam Ravnborg Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/qconf.cc | 93 +++++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 44 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index b9bb32dfd628..9fe27ca8a192 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -114,7 +114,7 @@ void ConfigItem::updateMenu(void) sym = menu->sym; prop = menu->prompt; - prompt = QString::fromLocal8Bit(menu_get_prompt(menu)); + prompt = _(menu_get_prompt(menu)); if (prop) switch (prop->type) { case P_MENU: @@ -208,7 +208,7 @@ void ConfigItem::updateMenu(void) break; } if (!sym_has_value(sym) && visible) - prompt += " (NEW)"; + prompt += _(" (NEW)"); set_prompt: setText(promptColIdx, prompt); } @@ -346,7 +346,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) for (i = 0; i < colNr; i++) colMap[i] = colRevMap[i] = -1; - addColumn(promptColIdx, "Option"); + addColumn(promptColIdx, _("Option")); reinit(); } @@ -360,14 +360,14 @@ void ConfigList::reinit(void) removeColumn(nameColIdx); if (showName) - addColumn(nameColIdx, "Name"); + addColumn(nameColIdx, _("Name")); if (showRange) { addColumn(noColIdx, "N"); addColumn(modColIdx, "M"); addColumn(yesColIdx, "Y"); } if (showData) - addColumn(dataColIdx, "Value"); + addColumn(dataColIdx, _("Value")); updateListAll(); } @@ -803,7 +803,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) QAction *action; headerPopup = new QPopupMenu(this); - action = new QAction(NULL, "Show Name", 0, this); + action = new QAction(NULL, _("Show Name"), 0, this); action->setToggleAction(TRUE); connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowName(bool))); @@ -811,7 +811,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) action, SLOT(setOn(bool))); action->setOn(showName); action->addTo(headerPopup); - action = new QAction(NULL, "Show Range", 0, this); + action = new QAction(NULL, _("Show Range"), 0, this); action->setToggleAction(TRUE); connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowRange(bool))); @@ -819,7 +819,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) action, SLOT(setOn(bool))); action->setOn(showRange); action->addTo(headerPopup); - action = new QAction(NULL, "Show Data", 0, this); + action = new QAction(NULL, _("Show Data"), 0, this); action->setToggleAction(TRUE); connect(action, SIGNAL(toggled(bool)), parent(), SLOT(setShowData(bool))); @@ -1041,7 +1041,12 @@ void ConfigInfoView::menuInfo(void) if (showDebug()) debug = debug_info(sym); - help = print_filter(_(menu_get_help(menu))); + help = menu_get_help(menu); + /* Gettextize if the help text not empty */ + if (help.isEmpty()) + help = print_filter(menu_get_help(menu)); + else + help = print_filter(_(menu_get_help(menu))); } else if (menu->prompt) { head += ""; head += print_filter(_(menu->prompt->text)); @@ -1167,7 +1172,7 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) { QPopupMenu* popup = Parent::createPopupMenu(pos); - QAction* action = new QAction(NULL,"Show Debug Info", 0, popup); + QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup); action->setToggleAction(TRUE); connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); @@ -1189,11 +1194,11 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam QVBoxLayout* layout1 = new QVBoxLayout(this, 11, 6); QHBoxLayout* layout2 = new QHBoxLayout(0, 0, 6); - layout2->addWidget(new QLabel("Find:", this)); + layout2->addWidget(new QLabel(_("Find:"), this)); editField = new QLineEdit(this); connect(editField, SIGNAL(returnPressed()), SLOT(search())); layout2->addWidget(editField); - searchButton = new QPushButton("Search", this); + searchButton = new QPushButton(_("Search"), this); searchButton->setAutoDefault(FALSE); connect(searchButton, SIGNAL(clicked()), SLOT(search())); layout2->addWidget(searchButton); @@ -1313,58 +1318,58 @@ ConfigMainWindow::ConfigMainWindow(void) menu = menuBar(); toolBar = new QToolBar("Tools", this); - backAction = new QAction("Back", QPixmap(xpm_back), "Back", 0, this); + backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this); connect(backAction, SIGNAL(activated()), SLOT(goBack())); backAction->setEnabled(FALSE); - QAction *quitAction = new QAction("Quit", "&Quit", CTRL+Key_Q, this); + QAction *quitAction = new QAction("Quit", _("&Quit"), CTRL+Key_Q, this); connect(quitAction, SIGNAL(activated()), SLOT(close())); - QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this); + QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), CTRL+Key_L, this); connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); - saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this); + saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), CTRL+Key_S, this); connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); conf_set_changed_callback(conf_changed); // Set saveAction's initial state conf_changed(); - QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this); + QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this); connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); - QAction *searchAction = new QAction("Find", "&Find", CTRL+Key_F, this); + QAction *searchAction = new QAction("Find", _("&Find"), CTRL+Key_F, this); connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); - QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this); + QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); - QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), "Split View", 0, this); + QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this); connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); - QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), "Full View", 0, this); + QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this); connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); - QAction *showNameAction = new QAction(NULL, "Show Name", 0, this); + QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this); showNameAction->setToggleAction(TRUE); connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); showNameAction->setOn(configView->showName()); - QAction *showRangeAction = new QAction(NULL, "Show Range", 0, this); + QAction *showRangeAction = new QAction(NULL, _("Show Range"), 0, this); showRangeAction->setToggleAction(TRUE); connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); showRangeAction->setOn(configList->showRange); - QAction *showDataAction = new QAction(NULL, "Show Data", 0, this); + QAction *showDataAction = new QAction(NULL, _("Show Data"), 0, this); showDataAction->setToggleAction(TRUE); connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); showDataAction->setOn(configList->showData); - QAction *showAllAction = new QAction(NULL, "Show All Options", 0, this); + QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this); showAllAction->setToggleAction(TRUE); connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool))); connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool))); showAllAction->setOn(configList->showAll); - QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this); + QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this); showDebugAction->setToggleAction(TRUE); connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); showDebugAction->setOn(helpText->showDebug()); - QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this); + QAction *showIntroAction = new QAction(NULL, _("Introduction"), 0, this); connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); - QAction *showAboutAction = new QAction(NULL, "About", 0, this); + QAction *showAboutAction = new QAction(NULL, _("About"), 0, this); connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); // init tool bar @@ -1379,7 +1384,7 @@ ConfigMainWindow::ConfigMainWindow(void) // create config menu QPopupMenu* config = new QPopupMenu(this); - menu->insertItem("&File", config); + menu->insertItem(_("&File"), config); loadAction->addTo(config); saveAction->addTo(config); saveAsAction->addTo(config); @@ -1388,12 +1393,12 @@ ConfigMainWindow::ConfigMainWindow(void) // create edit menu QPopupMenu* editMenu = new QPopupMenu(this); - menu->insertItem("&Edit", editMenu); + menu->insertItem(_("&Edit"), editMenu); searchAction->addTo(editMenu); // create options menu QPopupMenu* optionMenu = new QPopupMenu(this); - menu->insertItem("&Option", optionMenu); + menu->insertItem(_("&Option"), optionMenu); showNameAction->addTo(optionMenu); showRangeAction->addTo(optionMenu); showDataAction->addTo(optionMenu); @@ -1404,7 +1409,7 @@ ConfigMainWindow::ConfigMainWindow(void) // create help menu QPopupMenu* helpMenu = new QPopupMenu(this); menu->insertSeparator(); - menu->insertItem("&Help", helpMenu); + menu->insertItem(_("&Help"), helpMenu); showIntroAction->addTo(helpMenu); showAboutAction->addTo(helpMenu); @@ -1452,14 +1457,14 @@ void ConfigMainWindow::loadConfig(void) if (s.isNull()) return; if (conf_read(QFile::encodeName(s))) - QMessageBox::information(this, "qconf", "Unable to load configuration!"); + QMessageBox::information(this, "qconf", _("Unable to load configuration!")); ConfigView::updateListAll(); } void ConfigMainWindow::saveConfig(void) { if (conf_write(NULL)) - QMessageBox::information(this, "qconf", "Unable to save configuration!"); + QMessageBox::information(this, "qconf", _("Unable to save configuration!")); } void ConfigMainWindow::saveConfigAs(void) @@ -1468,7 +1473,7 @@ void ConfigMainWindow::saveConfigAs(void) if (s.isNull()) return; if (conf_write(QFile::encodeName(s))) - QMessageBox::information(this, "qconf", "Unable to save configuration!"); + QMessageBox::information(this, "qconf", _("Unable to save configuration!")); } void ConfigMainWindow::searchConfig(void) @@ -1612,11 +1617,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) e->accept(); return; } - QMessageBox mb("qconf", "Save configuration?", QMessageBox::Warning, + QMessageBox mb("qconf", _("Save configuration?"), QMessageBox::Warning, QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape); - mb.setButtonText(QMessageBox::Yes, "&Save Changes"); - mb.setButtonText(QMessageBox::No, "&Discard Changes"); - mb.setButtonText(QMessageBox::Cancel, "Cancel Exit"); + mb.setButtonText(QMessageBox::Yes, _("&Save Changes")); + mb.setButtonText(QMessageBox::No, _("&Discard Changes")); + mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit")); switch (mb.exec()) { case QMessageBox::Yes: conf_write(NULL); @@ -1631,7 +1636,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) void ConfigMainWindow::showIntro(void) { - static char str[] = "Welcome to the qconf graphical kernel configuration tool for Linux.\n\n" + static const QString str = _("Welcome to the qconf graphical kernel configuration tool for Linux.\n\n" "For each option, a blank box indicates the feature is disabled, a check\n" "indicates it is enabled, and a dot indicates that it is to be compiled\n" "as a module. Clicking on the box will cycle through the three states.\n\n" @@ -1641,15 +1646,15 @@ void ConfigMainWindow::showIntro(void) "options must be enabled to support the option you are interested in, you can\n" "still view the help of a grayed-out option.\n\n" "Toggling Show Debug Info under the Options menu will show the dependencies,\n" - "which you can then match by examining other options.\n\n"; + "which you can then match by examining other options.\n\n"); QMessageBox::information(this, "qconf", str); } void ConfigMainWindow::showAbout(void) { - static char str[] = "qconf is Copyright (C) 2002 Roman Zippel .\n\n" - "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"; + static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel .\n\n" + "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"); QMessageBox::information(this, "qconf", str); } @@ -1707,7 +1712,7 @@ static const char *progname; static void usage(void) { - printf("%s \n", progname); + printf(_("%s \n"), progname); exit(0); } -- cgit v1.2.3 From 413f006bab3845f12d7b2338a9b548aaf7808548 Mon Sep 17 00:00:00 2001 From: EGRY Gabor Date: Fri, 11 Jan 2008 23:50:37 +0100 Subject: kconfig: gettext support for menuconfig Full gettext support for menuconfig. Signed-off-by: Egry Gabor Reviewed-by: Sam Ravnborg Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/mconf.c | 51 +++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index ee9ed3059472..50e61c411bc0 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -289,11 +289,11 @@ static void get_prompt_str(struct gstr *r, struct property *prop) int i, j; struct menu *submenu[8], *menu; - str_printf(r, "Prompt: %s\n", prop->text); - str_printf(r, " Defined at %s:%d\n", prop->menu->file->name, + str_printf(r, _("Prompt: %s\n"), _(prop->text)); + str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, prop->menu->lineno); if (!expr_is_yes(prop->visible.expr)) { - str_append(r, " Depends on: "); + str_append(r, _(" Depends on: ")); expr_gstr_print(prop->visible.expr, r); str_append(r, "\n"); } @@ -301,13 +301,13 @@ static void get_prompt_str(struct gstr *r, struct property *prop) for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) submenu[i++] = menu; if (i > 0) { - str_printf(r, " Location:\n"); + str_printf(r, _(" Location:\n")); for (j = 4; --i >= 0; j += 2) { menu = submenu[i]; - str_printf(r, "%*c-> %s", j, ' ', menu_get_prompt(menu)); + str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); if (menu->sym) { str_printf(r, " (%s [=%s])", menu->sym->name ? - menu->sym->name : "", + menu->sym->name : _(""), sym_get_string_value(menu->sym)); } str_append(r, "\n"); @@ -337,7 +337,7 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym) if (hit) str_append(r, "\n"); if (sym->rev_dep.expr) { - str_append(r, " Selected by: "); + str_append(r, _(" Selected by: ")); expr_gstr_print(sym->rev_dep.expr, r); str_append(r, "\n"); } @@ -353,7 +353,7 @@ static struct gstr get_relations_str(struct symbol **sym_arr) for (i = 0; sym_arr && (sym = sym_arr[i]); i++) get_symbol_str(&res, sym); if (!i) - str_append(&res, "No matches found.\n"); + str_append(&res, _("No matches found.\n")); return res; } @@ -433,6 +433,7 @@ static void build_conf(struct menu *menu) switch (prop->type) { case P_MENU: child_count++; + prompt = _(prompt); if (single_menu_mode) { item_make("%s%*c%s", menu->data ? "-->" : "++>", @@ -448,7 +449,7 @@ static void build_conf(struct menu *menu) case P_COMMENT: if (prompt) { child_count++; - item_make(" %*c*** %s ***", indent + 1, ' ', prompt); + item_make(" %*c*** %s ***", indent + 1, ' ', _(prompt)); item_set_tag(':'); item_set_data(menu); } @@ -456,7 +457,7 @@ static void build_conf(struct menu *menu) default: if (prompt) { child_count++; - item_make("---%*c%s", indent + 1, ' ', prompt); + item_make("---%*c%s", indent + 1, ' ', _(prompt)); item_set_tag(':'); item_set_data(menu); } @@ -500,10 +501,10 @@ static void build_conf(struct menu *menu) item_set_data(menu); } - item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); + item_add_str("%*c%s", indent + 1, ' ', _(menu_get_prompt(menu))); if (val == yes) { if (def_menu) { - item_add_str(" (%s)", menu_get_prompt(def_menu)); + item_add_str(" (%s)", _(menu_get_prompt(def_menu))); item_add_str(" --->"); if (def_menu->list) { indent += 2; @@ -515,7 +516,7 @@ static void build_conf(struct menu *menu) } } else { if (menu == current_menu) { - item_make("---%*c%s", indent + 1, ' ', menu_get_prompt(menu)); + item_make("---%*c%s", indent + 1, ' ', _(menu_get_prompt(menu))); item_set_tag(':'); item_set_data(menu); goto conf_childs; @@ -558,17 +559,17 @@ static void build_conf(struct menu *menu) tmp = indent - tmp + 4; if (tmp < 0) tmp = 0; - item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu), + item_add_str("%*c%s%s", tmp, ' ', _(menu_get_prompt(menu)), (sym_has_value(sym) || !sym_is_changable(sym)) ? - "" : " (NEW)"); + "" : _(" (NEW)")); item_set_tag('s'); item_set_data(menu); goto conf_childs; } } - item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), + item_add_str("%*c%s%s", indent + 1, ' ', _(menu_get_prompt(menu)), (sym_has_value(sym) || !sym_is_changable(sym)) ? - "" : " (NEW)"); + "" : _(" (NEW)")); if (menu->prompt->type == P_MENU) { item_add_str(" --->"); return; @@ -606,7 +607,7 @@ static void conf(struct menu *menu) item_set_tag('S'); } dialog_clear(); - res = dialog_menu(prompt ? prompt : _("Main Menu"), + res = dialog_menu(prompt ? _(prompt) : _("Main Menu"), _(menu_instructions), active_menu, &s_scroll); if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) @@ -653,7 +654,7 @@ static void conf(struct menu *menu) if (sym) show_help(submenu); else - show_helptext("README", _(mconf_readme)); + show_helptext(_("README"), _(mconf_readme)); break; case 3: if (item_is_tag('t')) { @@ -711,13 +712,13 @@ static void show_help(struct menu *menu) str_append(&help, nohelp_text); } get_symbol_str(&help, sym); - show_helptext(menu_get_prompt(menu), str_get(&help)); + show_helptext(_(menu_get_prompt(menu)), str_get(&help)); str_free(&help); } static void conf_choice(struct menu *menu) { - const char *prompt = menu_get_prompt(menu); + const char *prompt = _(menu_get_prompt(menu)); struct menu *child; struct symbol *active; @@ -731,7 +732,7 @@ static void conf_choice(struct menu *menu) for (child = menu->list; child; child = child->next) { if (!menu_is_visible(child)) continue; - item_make("%s", menu_get_prompt(child)); + item_make("%s", _(menu_get_prompt(child))); item_set_data(child); if (child->sym == active) item_set_selected(1); @@ -739,7 +740,7 @@ static void conf_choice(struct menu *menu) item_set_tag('X'); } dialog_clear(); - res = dialog_checklist(prompt ? prompt : _("Main Menu"), + res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"), _(radiolist_instructions), 15, 70, 6); selected = item_activate_selected(); @@ -785,10 +786,10 @@ static void conf_string(struct menu *menu) heading = _(inputbox_instructions_string); break; default: - heading = "Internal mconf error!"; + heading = _("Internal mconf error!"); } dialog_clear(); - res = dialog_inputbox(prompt ? prompt : _("Main Menu"), + res = dialog_inputbox(prompt ? _(prompt) : _("Main Menu"), heading, 10, 75, sym_get_string_value(menu->sym)); switch (res) { -- cgit v1.2.3 From 75c0a8a55c31c0a21f7e9e64bc45e87e228a98f6 Mon Sep 17 00:00:00 2001 From: EGRY Gabor Date: Fri, 11 Jan 2008 23:42:54 +0100 Subject: kconfig: gettext support for lxdialog Gettext support for lxdialog. Signed-off-by: Egry Gabor Reviewed-by: Sam Ravnborg Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/POTFILES.in | 6 ++++++ scripts/kconfig/lxdialog/checklist.c | 4 ++-- scripts/kconfig/lxdialog/dialog.h | 6 ++++++ scripts/kconfig/lxdialog/inputbox.c | 4 ++-- scripts/kconfig/lxdialog/menubox.c | 6 +++--- scripts/kconfig/lxdialog/textbox.c | 2 +- scripts/kconfig/lxdialog/yesno.c | 4 ++-- 7 files changed, 22 insertions(+), 10 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/POTFILES.in b/scripts/kconfig/POTFILES.in index 19d0e63fb7ba..967457396990 100644 --- a/scripts/kconfig/POTFILES.in +++ b/scripts/kconfig/POTFILES.in @@ -1,3 +1,9 @@ +scripts/kconfig/lxdialog/checklist.c +scripts/kconfig/lxdialog/inputbox.c +scripts/kconfig/lxdialog/menubox.c +scripts/kconfig/lxdialog/textbox.c +scripts/kconfig/lxdialog/util.c +scripts/kconfig/lxdialog/yesno.c scripts/kconfig/mconf.c scripts/kconfig/conf.c scripts/kconfig/confdata.c diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c index cf697080dddd..b2a878c936d6 100644 --- a/scripts/kconfig/lxdialog/checklist.c +++ b/scripts/kconfig/lxdialog/checklist.c @@ -97,8 +97,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) int x = width / 2 - 11; int y = height - 2; - print_button(dialog, "Select", y, x, selected == 0); - print_button(dialog, " Help ", y, x + 14, selected == 1); + print_button(dialog, gettext("Select"), y, x, selected == 0); + print_button(dialog, gettext(" Help "), y, x + 14, selected == 1); wmove(dialog, y, x + 1 + 14 * selected); wrefresh(dialog); diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index c4ad37fd922c..b5211fce0d94 100644 --- a/scripts/kconfig/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h @@ -26,6 +26,12 @@ #include #include +#ifndef KBUILD_NO_NLS +# include +#else +# define gettext(Msgid) ((const char *) (Msgid)) +#endif + #ifdef __sun__ #define CURS_MACROS #endif diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c index 05e72066b359..4946bd02b46d 100644 --- a/scripts/kconfig/lxdialog/inputbox.c +++ b/scripts/kconfig/lxdialog/inputbox.c @@ -31,8 +31,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) int x = width / 2 - 11; int y = height - 2; - print_button(dialog, " Ok ", y, x, selected == 0); - print_button(dialog, " Help ", y, x + 14, selected == 1); + print_button(dialog, gettext(" Ok "), y, x, selected == 0); + print_button(dialog, gettext(" Help "), y, x + 14, selected == 1); wmove(dialog, y, x + 1 + 14 * selected); wrefresh(dialog); diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c index 0d83159d9012..fa9d633f293c 100644 --- a/scripts/kconfig/lxdialog/menubox.c +++ b/scripts/kconfig/lxdialog/menubox.c @@ -157,9 +157,9 @@ static void print_buttons(WINDOW * win, int height, int width, int selected) int x = width / 2 - 16; int y = height - 2; - print_button(win, "Select", y, x, selected == 0); - print_button(win, " Exit ", y, x + 12, selected == 1); - print_button(win, " Help ", y, x + 24, selected == 2); + print_button(win, gettext("Select"), y, x, selected == 0); + print_button(win, gettext(" Exit "), y, x + 12, selected == 1); + print_button(win, gettext(" Help "), y, x + 24, selected == 2); wmove(win, y, x + 1 + 12 * selected); wrefresh(win); diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c index fabfc1ad789d..c704712d0227 100644 --- a/scripts/kconfig/lxdialog/textbox.c +++ b/scripts/kconfig/lxdialog/textbox.c @@ -114,7 +114,7 @@ do_resize: print_title(dialog, title, width); - print_button(dialog, " Exit ", height - 2, width / 2 - 4, TRUE); + print_button(dialog, gettext(" Exit "), height - 2, width / 2 - 4, TRUE); wnoutrefresh(dialog); getyx(dialog, cur_y, cur_x); /* Save cursor position */ diff --git a/scripts/kconfig/lxdialog/yesno.c b/scripts/kconfig/lxdialog/yesno.c index ee0a04e3e012..4e6e8090c20b 100644 --- a/scripts/kconfig/lxdialog/yesno.c +++ b/scripts/kconfig/lxdialog/yesno.c @@ -29,8 +29,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) int x = width / 2 - 10; int y = height - 2; - print_button(dialog, " Yes ", y, x, selected == 0); - print_button(dialog, " No ", y, x + 13, selected == 1); + print_button(dialog, gettext(" Yes "), y, x, selected == 0); + print_button(dialog, gettext(" No "), y, x + 13, selected == 1); wmove(dialog, y, x + 1 + 13 * selected); wrefresh(dialog); -- cgit v1.2.3 From 534a450c383ef238b0461218bc2d3e54066ae043 Mon Sep 17 00:00:00 2001 From: EGRY Gabor Date: Fri, 11 Jan 2008 23:44:39 +0100 Subject: kconfig: gettext support for config Gettext support for conf.c [Include locale.h by Kyle]. Signed-off-by: Egry Gabor Reviewed-by: Sam Ravnborg Signed-off-by: Sam Ravnborg Cc: Roman Zippel Cc: Kyle McMartin --- scripts/kconfig/conf.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 01c2f3505f5d..d1a0368bd438 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -3,6 +3,7 @@ * Released under the terms of the GNU GPL v2.0. */ +#include #include #include #include @@ -40,7 +41,7 @@ static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n" static const char *get_help(struct menu *menu) { if (menu_has_help(menu)) - return menu_get_help(menu); + return _(menu_get_help(menu)); else return nohelp_text; } @@ -78,7 +79,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) tristate val; if (!sym_has_value(sym)) - printf("(NEW) "); + printf(_("(NEW) ")); line[0] = '\n'; line[1] = 0; @@ -183,7 +184,7 @@ int conf_string(struct menu *menu) const char *def; while (1) { - printf("%*s%s ", indent - 1, "", menu->prompt->text); + printf("%*s%s ", indent - 1, "", _(menu->prompt->text)); printf("(%s) ", sym->name); def = sym_get_string_value(sym); if (sym_get_string_value(sym)) @@ -216,7 +217,7 @@ static int conf_sym(struct menu *menu) tristate oldval, newval; while (1) { - printf("%*s%s ", indent - 1, "", menu->prompt->text); + printf("%*s%s ", indent - 1, "", _(menu->prompt->text)); if (sym->name) printf("(%s) ", sym->name); type = sym_get_type(sym); @@ -306,7 +307,7 @@ static int conf_choice(struct menu *menu) case no: return 1; case mod: - printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); + printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu))); return 0; case yes: break; @@ -316,7 +317,7 @@ static int conf_choice(struct menu *menu) while (1) { int cnt, def; - printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); + printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu))); def_sym = sym_get_choice_value(sym); cnt = def = 0; line[0] = 0; @@ -324,7 +325,7 @@ static int conf_choice(struct menu *menu) if (!menu_is_visible(child)) continue; if (!child->sym) { - printf("%*c %s\n", indent, '*', menu_get_prompt(child)); + printf("%*c %s\n", indent, '*', _(menu_get_prompt(child))); continue; } cnt++; @@ -333,14 +334,14 @@ static int conf_choice(struct menu *menu) printf("%*c", indent, '>'); } else printf("%*c", indent, ' '); - printf(" %d. %s", cnt, menu_get_prompt(child)); + printf(" %d. %s", cnt, _(menu_get_prompt(child))); if (child->sym->name) printf(" (%s)", child->sym->name); if (!sym_has_value(child->sym)) - printf(" (NEW)"); + printf(_(" (NEW)")); printf("\n"); } - printf("%*schoice", indent - 1, ""); + printf(_("%*schoice"), indent - 1, ""); if (cnt == 1) { printf("[1]: 1\n"); goto conf_childs; @@ -433,7 +434,7 @@ static void conf(struct menu *menu) if (prompt) printf("%*c\n%*c %s\n%*c\n", indent, '*', - indent, '*', prompt, + indent, '*', _(prompt), indent, '*'); default: ; @@ -499,6 +500,10 @@ int main(int ac, char **av) const char *name; struct stat tmpstat; + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) { switch (opt) { case 'o': @@ -529,11 +534,11 @@ int main(int ac, char **av) srand(time(NULL)); break; case 'h': - printf("See README for usage info\n"); + printf(_("See README for usage info\n")); exit(0); break; default: - fprintf(stderr, "See README for usage info\n"); + fprintf(stderr, _("See README for usage info\n")); exit(1); } } @@ -549,9 +554,9 @@ int main(int ac, char **av) if (!defconfig_file) defconfig_file = conf_get_default_confname(); if (conf_read(defconfig_file)) { - printf("***\n" + printf(_("***\n" "*** Can't find default configuration \"%s\"!\n" - "***\n", defconfig_file); + "***\n"), defconfig_file); exit(1); } break; -- cgit v1.2.3 From 0ffce8d94487abbd332cd36f98db61b7c8a3db3c Mon Sep 17 00:00:00 2001 From: EGRY Gabor Date: Fri, 11 Jan 2008 23:49:12 +0100 Subject: kconfig: gconfig: symbol fix Gettext support for symbol names are unnecessary. Signed-off-by: Egry Gabor Reviewed-by: Sam Ravnborg Signed-off-by: Sam Ravnborg Cc: Roman Zippel --- scripts/kconfig/gconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index dfe748c38b72..199b22bb49e2 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c @@ -466,7 +466,7 @@ static void text_insert_help(struct menu *menu) help = _(help); if (menu->sym && menu->sym->name) - name = g_strdup_printf(_(menu->sym->name)); + name = g_strdup_printf(menu->sym->name); else name = g_strdup(""); -- cgit v1.2.3 From 7a962923359768e04137125bd479fd0dfa6117d3 Mon Sep 17 00:00:00 2001 From: Roman Zippel Date: Mon, 14 Jan 2008 04:50:23 +0100 Subject: kconfig: explicitly introduce expression list Rename E_CHOICE to E_LIST to explicitly add support for expression lists. Add a helper macro expr_list_for_each_sym to more easily iterate over the list. Signed-off-by: Roman Zippel Signed-off-by: Sam Ravnborg --- scripts/kconfig/confdata.c | 8 ++++---- scripts/kconfig/expr.c | 16 ++++++++-------- scripts/kconfig/expr.h | 5 ++++- scripts/kconfig/menu.c | 2 +- scripts/kconfig/symbol.c | 13 +++++++------ 5 files changed, 24 insertions(+), 20 deletions(-) (limited to 'scripts/kconfig') diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 497a19e85a07..ee5fe943d58d 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -312,7 +312,7 @@ load: int conf_read(const char *name) { - struct symbol *sym; + struct symbol *sym, *choice_sym; struct property *prop; struct expr *e; int i, flags; @@ -353,9 +353,9 @@ int conf_read(const char *name) */ prop = sym_get_choice_prop(sym); flags = sym->flags; - for (e = prop->expr; e; e = e->left.expr) - if (e->right.sym->visible != no) - flags &= e->right.sym->flags; + expr_list_for_each_sym(prop->expr, e, choice_sym) + if (choice_sym->visible != no) + flags &= choice_sym->flags; sym->flags &= flags | ~SYMBOL_DEF_USER; } diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index c8793d1d908f..13788ada5228 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -87,7 +87,7 @@ struct expr *expr_copy(struct expr *org) break; case E_AND: case E_OR: - case E_CHOICE: +