From 4b7594e81e4d92f44dddd2b7fe690caa9c7049b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 21 Apr 2015 14:04:12 +0200 Subject: Rename parser.c to parse.c --- scripts/parse_kconfig/Makefile | 2 +- scripts/parse_kconfig/parse.c | 112 +++++++++++++++++++++++++++++++++++++++++ scripts/parse_kconfig/parser.c | 112 ----------------------------------------- 3 files changed, 113 insertions(+), 113 deletions(-) create mode 100644 scripts/parse_kconfig/parse.c delete mode 100644 scripts/parse_kconfig/parser.c (limited to 'scripts/parse_kconfig') diff --git a/scripts/parse_kconfig/Makefile b/scripts/parse_kconfig/Makefile index 66f4151..98c8531 100644 --- a/scripts/parse_kconfig/Makefile +++ b/scripts/parse_kconfig/Makefile @@ -7,7 +7,7 @@ all: parse KCONFIG_PREFIX = ../shared/kconfig include $(KCONFIG_PREFIX)/files.mk -SRC = parser.c \ +SRC = parse.c \ cnfexpr.c \ symlist.c \ output.c diff --git a/scripts/parse_kconfig/parse.c b/scripts/parse_kconfig/parse.c new file mode 100644 index 0000000..7d6bf3f --- /dev/null +++ b/scripts/parse_kconfig/parse.c @@ -0,0 +1,112 @@ +#include +#include +#include +#include +#include +#include +#include +#include "symlist.h" +#include "output.h" +#include "macros.h" + +int verbose_level; +char *file, *folder; + +struct symlist *gsymlist; +int noname_num; + +void build_symlist(); +void cpy_dep(); + +int main(int argc, char **argv) { + verbose_level = 1; + int i; + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "-v")) + verbose_level++; + else if (file == NULL) + file = argv[i]; + else if (folder == NULL) + folder = argv[i]; + else { + Eprintf("Unknown parameter: %s\n", argv[i]); + exit(1); + } + } + + if (file == NULL) { + Eprintf("No Kconfig input file specified\n"); + exit(2); + } + if (folder == NULL) { + Eprintf("No output folder specified\n"); + exit(3); + } + + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + + conf_parse(file); + //sym_clear_all_valid(); + + gsymlist = symlist_create(); + + build_symlist(); + cpy_dep(); + + char *rules_file, *symbol_map_file; + asprintf(&rules_file, "%s/%s", folder, DEFAULT_RULES_FILE); + asprintf(&symbol_map_file, "%s/%s", folder, DEFAULT_SYMBOL_MAP_FILE); + fprint_rules(gsymlist, rules_file); + fprint_symbol_map(gsymlist, symbol_map_file); + return 0; +} + +void build_symlist() { + int i; + struct symbol *sym; + for_all_symbols(i, sym) { + if (sym->type == S_BOOLEAN || sym->type == S_TRISTATE) { + if (sym->name != NULL) { + symlist_add(gsymlist, sym->name); + } else { + sym->name = malloc((9 + 7) * sizeof(char)); + sprintf(sym->name, "NONAMEGEN%d", noname_num++); + symlist_add(gsymlist, sym->name); + } + } + } +} + +void cpy_dep() { + int i; + struct symbol *sym; + struct symlist_el *el; + for_all_symbols(i, sym) { + if ((sym->type == S_BOOLEAN || sym->type == S_TRISTATE) + && strstr(sym->name, "NONAMEGEN") == NULL) { + el = symlist_find(gsymlist, sym->name); + Iprintf("working: %s(%d)\n", sym->name, el->id); + + if (sym->dir_dep.expr != NULL) { + if (verbose_level > 3) + printf_original(gsymlist, sym->dir_dep.expr); + el->be = + kconfig_cnfexpr(gsymlist, false, sym->dir_dep.expr); + Iprintf("Direct:\n"); + if (verbose_level > 2) + cnf_printf(el->be); + } + if (sym->rev_dep.expr != NULL) { + if (verbose_level > 3) + printf_original(gsymlist, sym->rev_dep.expr); + el->re_be = + kconfig_cnfexpr(gsymlist, true, sym->rev_dep.expr); + Iprintf("Revers:\n"); + if (verbose_level > 2) + cnf_printf(el->re_be); + } + } + } +} diff --git a/scripts/parse_kconfig/parser.c b/scripts/parse_kconfig/parser.c deleted file mode 100644 index 7d6bf3f..0000000 --- a/scripts/parse_kconfig/parser.c +++ /dev/null @@ -1,112 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include "symlist.h" -#include "output.h" -#include "macros.h" - -int verbose_level; -char *file, *folder; - -struct symlist *gsymlist; -int noname_num; - -void build_symlist(); -void cpy_dep(); - -int main(int argc, char **argv) { - verbose_level = 1; - int i; - for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-v")) - verbose_level++; - else if (file == NULL) - file = argv[i]; - else if (folder == NULL) - folder = argv[i]; - else { - Eprintf("Unknown parameter: %s\n", argv[i]); - exit(1); - } - } - - if (file == NULL) { - Eprintf("No Kconfig input file specified\n"); - exit(2); - } - if (folder == NULL) { - Eprintf("No output folder specified\n"); - exit(3); - } - - setlocale(LC_ALL, ""); - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); - - conf_parse(file); - //sym_clear_all_valid(); - - gsymlist = symlist_create(); - - build_symlist(); - cpy_dep(); - - char *rules_file, *symbol_map_file; - asprintf(&rules_file, "%s/%s", folder, DEFAULT_RULES_FILE); - asprintf(&symbol_map_file, "%s/%s", folder, DEFAULT_SYMBOL_MAP_FILE); - fprint_rules(gsymlist, rules_file); - fprint_symbol_map(gsymlist, symbol_map_file); - return 0; -} - -void build_symlist() { - int i; - struct symbol *sym; - for_all_symbols(i, sym) { - if (sym->type == S_BOOLEAN || sym->type == S_TRISTATE) { - if (sym->name != NULL) { - symlist_add(gsymlist, sym->name); - } else { - sym->name = malloc((9 + 7) * sizeof(char)); - sprintf(sym->name, "NONAMEGEN%d", noname_num++); - symlist_add(gsymlist, sym->name); - } - } - } -} - -void cpy_dep() { - int i; - struct symbol *sym; - struct symlist_el *el; - for_all_symbols(i, sym) { - if ((sym->type == S_BOOLEAN || sym->type == S_TRISTATE) - && strstr(sym->name, "NONAMEGEN") == NULL) { - el = symlist_find(gsymlist, sym->name); - Iprintf("working: %s(%d)\n", sym->name, el->id); - - if (sym->dir_dep.expr != NULL) { - if (verbose_level > 3) - printf_original(gsymlist, sym->dir_dep.expr); - el->be = - kconfig_cnfexpr(gsymlist, false, sym->dir_dep.expr); - Iprintf("Direct:\n"); - if (verbose_level > 2) - cnf_printf(el->be); - } - if (sym->rev_dep.expr != NULL) { - if (verbose_level > 3) - printf_original(gsymlist, sym->rev_dep.expr); - el->re_be = - kconfig_cnfexpr(gsymlist, true, sym->rev_dep.expr); - Iprintf("Revers:\n"); - if (verbose_level > 2) - cnf_printf(el->re_be); - } - } - } -} -- cgit v1.2.3