History

kconfig: allow build-time definition of the internal config prefix

Arnaud Lacombe committed 16 years ago

Commit ffb59571 parent 59dfa246 files · +43 −34Browse files

Showing the changes to scripts (6 of 6 files). Show all

Unified · Split

6 files
  1. scripts/kconfig/conf.c +1 −1
  2. scripts/kconfig/confdata.c +27 −21
  3. scripts/kconfig/lkc.h +3 −0
  4. scripts/kconfig/mconf.c +5 −5
  5. scripts/kconfig/menu.c +1 −1
  6. scripts/kconfig/nconf.c +6 −6
scripts/kconfig/conf.c+1−1
@@ -425,7 +425,7 @@ static void check_conf(struct menu *menu) · 424 unmodified lines
425 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {425 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
426 if (input_mode == listnewconfig) {426 if (input_mode == listnewconfig) {
427 if (sym->name && !sym_is_choice_value(sym)) {427 if (sym->name && !sym_is_choice_value(sym)) {
428 printf("CONFIG_%s\n", sym->name);428 printf("%s%s\n", CONFIG_, sym->name);
429 }429 }
430 } else if (input_mode != oldnoconfig) {430 } else if (input_mode != oldnoconfig) {
431 if (!conf_cnt++)431 if (!conf_cnt++)
scripts/kconfig/confdata.c+27−21
@@ -222,22 +222,22 @@ load: · 221 unmodified lines
222 conf_lineno++;222 conf_lineno++;
223 sym = NULL;223 sym = NULL;
224 if (line[0] == '#') {224 if (line[0] == '#') {
225 if (memcmp(line + 2, "CONFIG_", 7))225 if (memcmp(line + 2, CONFIG_, strlen(CONFIG_)))
226 continue;226 continue;
227 p = strchr(line + 9, ' ');227 p = strchr(line + 2 + strlen(CONFIG_), ' ');
228 if (!p)228 if (!p)
229 continue;229 continue;
230 *p++ = 0;230 *p++ = 0;
231 if (strncmp(p, "is not set", 10))231 if (strncmp(p, "is not set", 10))
232 continue;232 continue;
233 if (def == S_DEF_USER) {233 if (def == S_DEF_USER) {
234 sym = sym_find(line + 9);234 sym = sym_find(line + 2 + strlen(CONFIG_));
235 if (!sym) {235 if (!sym) {
236 sym_add_change_count(1);236 sym_add_change_count(1);
237 break;237 break;
238 }238 }
239 } else {239 } else {
240 sym = sym_lookup(line + 9, 0);240 sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
241 if (sym->type == S_UNKNOWN)241 if (sym->type == S_UNKNOWN)
242 sym->type = S_BOOLEAN;242 sym->type = S_BOOLEAN;
243 }243 }
@@ -253,8 +253,8 @@ load: · 9 unmodified lines
253 default:253 default:
254 ;254 ;
255 }255 }
256 } else if (memcmp(line, "CONFIG_", 7) == 0) {256 } else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) {
257 p = strchr(line + 7, '=');257 p = strchr(line + strlen(CONFIG_), '=');
258 if (!p)258 if (!p)
259 continue;259 continue;
260 *p++ = 0;260 *p++ = 0;
@@ -265,13 +265,13 @@ load: · 4 unmodified lines
265 *p2 = 0;265 *p2 = 0;
266 }266 }
267 if (def == S_DEF_USER) {267 if (def == S_DEF_USER) {
268 sym = sym_find(line + 7);268 sym = sym_find(line + strlen(CONFIG_));
269 if (!sym) {269 if (!sym) {
270 sym_add_change_count(1);270 sym_add_change_count(1);
271 break;271 break;
272 }272 }
273 } else {273 } else {
274 sym = sym_lookup(line + 7, 0);274 sym = sym_lookup(line + strlen(CONFIG_), 0);
275 if (sym->type == S_UNKNOWN)275 if (sym->type == S_UNKNOWN)
276 sym->type = S_OTHER;276 sym->type = S_OTHER;
277 }277 }
@@ -397,9 +397,9 @@ static void conf_write_string(bool headerfile, const char *name, · 119 unmodified lines
397{397{
398 int l;398 int l;
399 if (headerfile)399 if (headerfile)
400 fprintf(out, "#define CONFIG_%s \"", name);400 fprintf(out, "#define %s%s \"", CONFIG_, name);
401 else401 else
402 fprintf(out, "CONFIG_%s=\"", name);402 fprintf(out, "%s%s=\"", CONFIG_, name);
403 403
404 while (1) {404 while (1) {
405 l = strcspn(str, "\"\\");405 l = strcspn(str, "\"\\");
@@ -425,13 +425,14 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type, · 19 unmodified lines
425 switch (sym_get_tristate_value(sym)) {425 switch (sym_get_tristate_value(sym)) {
426 case no:426 case no:
427 if (write_no)427 if (write_no)
428 fprintf(out, "# CONFIG_%s is not set\n", sym->name);428 fprintf(out, "# %s%s is not set\n",
429 CONFIG_, sym->name);
429 break;430 break;
430 case mod:431 case mod:
431 fprintf(out, "CONFIG_%s=m\n", sym->name);432 fprintf(out, "%s%s=m\n", CONFIG_, sym->name);
432 break;433 break;
433 case yes:434 case yes:
434 fprintf(out, "CONFIG_%s=y\n", sym->name);435 fprintf(out, "%s%s=y\n", CONFIG_, sym->name);
435 break;436 break;
436 }437 }
437 break;438 break;
@@ -441,7 +442,7 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type, · 3 unmodified lines
441 case S_HEX:442 case S_HEX:
442 case S_INT:443 case S_INT:
443 str = sym_get_string_value(sym);444 str = sym_get_string_value(sym);
444 fprintf(out, "CONFIG_%s=%s\n", sym->name, str);445 fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str);
445 break;446 break;
446 case S_OTHER:447 case S_OTHER:
447 case S_UNKNOWN:448 case S_UNKNOWN:
@@ -832,14 +833,17 @@ int conf_write_autoconf(void) · 384 unmodified lines
832 case no:833 case no:
833 break;834 break;
834 case mod:835 case mod:
835 fprintf(tristate, "CONFIG_%s=M\n", sym->name);836 fprintf(tristate, "%s%s=M\n",
836 fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name);837 CONFIG_, sym->name);
838 fprintf(out_h, "#define %s%s_MODULE 1\n",
839 CONFIG_, sym->name);
837 break;840 break;
838 case yes:841 case yes:
839 if (sym->type == S_TRISTATE)842 if (sym->type == S_TRISTATE)
840 fprintf(tristate, "CONFIG_%s=Y\n",843 fprintf(tristate,"%s%s=Y\n",
841 sym->name);844 CONFIG_, sym->name);
842 fprintf(out_h, "#define CONFIG_%s 1\n", sym->name);845 fprintf(out_h, "#define %s%s 1\n",
846 CONFIG_, sym->name);
843 break;847 break;
844 }848 }
845 break;849 break;
@@ -849,12 +853,14 @@ int conf_write_autoconf(void) · 3 unmodified lines
849 case S_HEX:853 case S_HEX:
850 str = sym_get_string_value(sym);854 str = sym_get_string_value(sym);
851 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {855 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
852 fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str);856 fprintf(out_h, "#define %s%s 0x%s\n",
857 CONFIG_, sym->name, str);
853 break;858 break;
854 }859 }
855 case S_INT:860 case S_INT:
856 str = sym_get_string_value(sym);861 str = sym_get_string_value(sym);
857 fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str);862 fprintf(out_h, "#define %s%s %s\n",
863 CONFIG_, sym->name, str);
858 break;864 break;
859 default:865 default:
860 break;866 break;
scripts/kconfig/lkc.h+3−0
@@ -37,6 +37,9 @@ extern "C" { · 36 unmodified lines
37#define _(text) gettext(text)37#define _(text) gettext(text)
38#define N_(text) (text)38#define N_(text) (text)
39 39
40#ifndef CONFIG_
41#define CONFIG_ "CONFIG_"
42#endif
40 43
41#define TF_COMMAND 0x000144#define TF_COMMAND 0x0001
42#define TF_PARAM 0x000245#define TF_PARAM 0x0002
scripts/kconfig/mconf.c+5−5
@@ -316,8 +316,8 @@ static void search_conf(void) · 315 unmodified lines
316again:316again:
317 dialog_clear();317 dialog_clear();
318 dres = dialog_inputbox(_("Search Configuration Parameter"),318 dres = dialog_inputbox(_("Search Configuration Parameter"),
319 _("Enter CONFIG_ (sub)string to search for "319 _("Enter " CONFIG_ " (sub)string to search for "
320 "(with or without \"CONFIG\")"),320 "(with or without \"" CONFIG_ "\")"),
321 10, 75, "");321 10, 75, "");
322 switch (dres) {322 switch (dres) {
323 case 0:323 case 0:
@@ -329,10 +329,10 @@ again: · 5 unmodified lines
329 return;329 return;
330 }330 }
331 331
332 /* strip CONFIG_ if necessary */332 /* strip the prefix if necessary */
333 dialog_input = dialog_input_result;333 dialog_input = dialog_input_result;
334 if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0)334 if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
335 dialog_input += 7;335 dialog_input += strlen(CONFIG_);
336 336
337 sym_arr = sym_re_search(dialog_input);337 sym_arr = sym_re_search(dialog_input);
338 res = get_relations_str(sym_arr);338 res = get_relations_str(sym_arr);
scripts/kconfig/menu.c+1−1
@@ -566,7 +566,7 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help) · 565 unmodified lines
566 566
567 if (menu_has_help(menu)) {567 if (menu_has_help(menu)) {
568 if (sym->name) {568 if (sym->name) {
569 str_printf(help, "CONFIG_%s:\n\n", sym->name);569 str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
570 str_append(help, _(menu_get_help(menu)));570 str_append(help, _(menu_get_help(menu)));
571 str_append(help, "\n");571 str_append(help, "\n");
572 }572 }
scripts/kconfig/nconf.c+6−6
@@ -744,8 +744,8 @@ static void search_conf(void) · 743 unmodified lines
744again:744again:
745 dres = dialog_inputbox(main_window,745 dres = dialog_inputbox(main_window,
746 _("Search Configuration Parameter"),746 _("Search Configuration Parameter"),
747 _("Enter CONFIG_ (sub)string to search for "747 _("Enter " CONFIG_ " (sub)string to search for "
748 "(with or without \"CONFIG\")"),748 "(with or without \"" CONFIG_ "\")"),
749 "", dialog_input_result, 99);749 "", dialog_input_result, 99);
750 switch (dres) {750 switch (dres) {
751 case 0:751 case 0:
@@ -758,10 +758,10 @@ again: · 6 unmodified lines
758 return;758 return;
759 }759 }
760 760
761 /* strip CONFIG_ if necessary */761 /* strip the prefix if necessary */
762 dialog_input = dialog_input_result;762 dialog_input = dialog_input_result;
763 if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0)763 if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
764 dialog_input += 7;764 dialog_input += strlen(CONFIG_);
765 765
766 sym_arr = sym_re_search(dialog_input);766 sym_arr = sym_re_search(dialog_input);
767 res = get_relations_str(sym_arr);767 res = get_relations_str(sym_arr);
@@ -1261,7 +1261,7 @@ static void show_help(struct menu *menu) · 493 unmodified lines
1261 1261
1262 if (menu && menu->sym && menu_has_help(menu)) {1262 if (menu && menu->sym && menu_has_help(menu)) {
1263 if (menu->sym->name) {1263 if (menu->sym->name) {
1264 str_printf(&help, "CONFIG_%s:\n\n", menu->sym->name);1264 str_printf(&help, "%s%s:\n\n", CONFIG_, menu->sym->name);
1265 str_append(&help, _(menu_get_help(menu)));1265 str_append(&help, _(menu_get_help(menu)));
1266 str_append(&help, "\n");1266 str_append(&help, "\n");
1267 get_symbol_str(&help, menu->sym);1267 get_symbol_str(&help, menu->sym);