diff options
-rw-r--r-- | programs/.gitignore | 4 | ||||
-rw-r--r-- | programs/src/kconfig/output.h | 14 | ||||
-rw-r--r-- | programs/src/kconfig_parser/Makefile (renamed from programs/src/kconfig/Makefile) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/boolexp.c (renamed from programs/src/kconfig/boolexp.c) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/boolexp.h (renamed from programs/src/kconfig/boolexp.h) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/confdata.c (renamed from programs/src/kconfig/kconfig/confdata.c) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/expr.c (renamed from programs/src/kconfig/kconfig/expr.c) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/expr.h (renamed from programs/src/kconfig/kconfig/expr.h) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/list.h (renamed from programs/src/kconfig/kconfig/list.h) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/lkc.h (renamed from programs/src/kconfig/kconfig/lkc.h) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/lkc_proto.h (renamed from programs/src/kconfig/kconfig/lkc_proto.h) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/menu.c (renamed from programs/src/kconfig/kconfig/menu.c) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/symbol.c (renamed from programs/src/kconfig/kconfig/symbol.c) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/util.c (renamed from programs/src/kconfig/kconfig/util.c) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/zconf.gperf (renamed from programs/src/kconfig/kconfig/zconf.gperf) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/zconf.hash.c (renamed from programs/src/kconfig/kconfig/zconf.hash.c) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/zconf.l (renamed from programs/src/kconfig/kconfig/zconf.l) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/zconf.lex.c (renamed from programs/src/kconfig/kconfig/zconf.lex.c) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/zconf.tab.c (renamed from programs/src/kconfig/kconfig/zconf.tab.c) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig/zconf.y (renamed from programs/src/kconfig/kconfig/zconf.y) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/kconfig_parser.c (renamed from programs/src/kconfig/kconfig_parser.c) | 14 | ||||
-rw-r--r-- | programs/src/kconfig_parser/output.c (renamed from programs/src/kconfig/output.c) | 14 | ||||
-rw-r--r-- | programs/src/kconfig_parser/output.h | 14 | ||||
-rw-r--r-- | programs/src/kconfig_parser/symlist.c (renamed from programs/src/kconfig/symlist.c) | 0 | ||||
-rw-r--r-- | programs/src/kconfig_parser/symlist.h (renamed from programs/src/kconfig/symlist.h) | 0 |
25 files changed, 35 insertions, 25 deletions
diff --git a/programs/.gitignore b/programs/.gitignore new file mode 100644 index 0000000..9d3272d --- /dev/null +++ b/programs/.gitignore @@ -0,0 +1,4 @@ +.* +!/.gitignore + +kconfig_parser diff --git a/programs/src/kconfig/output.h b/programs/src/kconfig/output.h deleted file mode 100644 index aefbc0f..0000000 --- a/programs/src/kconfig/output.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _OUTPUT_H_ -#define _OUTPUT_H_ - -#include <stdlib.h> -#include <stdio.h> -#include "symlist.h" - -#define RULES_FILE "rules" -#define LINKER_FILE "linker" - -void fprint_rules(struct symlist *sl); -void fprint_linker(struct symlist *sl); - -#endif /* _OUTPUT_H_ */ diff --git a/programs/src/kconfig/Makefile b/programs/src/kconfig_parser/Makefile index cc86499..cc86499 100644 --- a/programs/src/kconfig/Makefile +++ b/programs/src/kconfig_parser/Makefile diff --git a/programs/src/kconfig/boolexp.c b/programs/src/kconfig_parser/boolexp.c index a41937a..a41937a 100644 --- a/programs/src/kconfig/boolexp.c +++ b/programs/src/kconfig_parser/boolexp.c diff --git a/programs/src/kconfig/boolexp.h b/programs/src/kconfig_parser/boolexp.h index f03fc33..f03fc33 100644 --- a/programs/src/kconfig/boolexp.h +++ b/programs/src/kconfig_parser/boolexp.h diff --git a/programs/src/kconfig/kconfig/confdata.c b/programs/src/kconfig_parser/kconfig/confdata.c index f88d90f..f88d90f 100644 --- a/programs/src/kconfig/kconfig/confdata.c +++ b/programs/src/kconfig_parser/kconfig/confdata.c diff --git a/programs/src/kconfig/kconfig/expr.c b/programs/src/kconfig_parser/kconfig/expr.c index d662652..d662652 100644 --- a/programs/src/kconfig/kconfig/expr.c +++ b/programs/src/kconfig_parser/kconfig/expr.c diff --git a/programs/src/kconfig/kconfig/expr.h b/programs/src/kconfig_parser/kconfig/expr.h index 412ea8a..412ea8a 100644 --- a/programs/src/kconfig/kconfig/expr.h +++ b/programs/src/kconfig_parser/kconfig/expr.h diff --git a/programs/src/kconfig/kconfig/list.h b/programs/src/kconfig_parser/kconfig/list.h index 685d80e..685d80e 100644 --- a/programs/src/kconfig/kconfig/list.h +++ b/programs/src/kconfig_parser/kconfig/list.h diff --git a/programs/src/kconfig/kconfig/lkc.h b/programs/src/kconfig_parser/kconfig/lkc.h index d5daa7a..d5daa7a 100644 --- a/programs/src/kconfig/kconfig/lkc.h +++ b/programs/src/kconfig_parser/kconfig/lkc.h diff --git a/programs/src/kconfig/kconfig/lkc_proto.h b/programs/src/kconfig_parser/kconfig/lkc_proto.h index ecdb965..ecdb965 100644 --- a/programs/src/kconfig/kconfig/lkc_proto.h +++ b/programs/src/kconfig_parser/kconfig/lkc_proto.h diff --git a/programs/src/kconfig/kconfig/menu.c b/programs/src/kconfig_parser/kconfig/menu.c index a26cc5d..a26cc5d 100644 --- a/programs/src/kconfig/kconfig/menu.c +++ b/programs/src/kconfig_parser/kconfig/menu.c diff --git a/programs/src/kconfig/kconfig/symbol.c b/programs/src/kconfig_parser/kconfig/symbol.c index 7caabdb..7caabdb 100644 --- a/programs/src/kconfig/kconfig/symbol.c +++ b/programs/src/kconfig_parser/kconfig/symbol.c diff --git a/programs/src/kconfig/kconfig/util.c b/programs/src/kconfig_parser/kconfig/util.c index 94f9c83..94f9c83 100644 --- a/programs/src/kconfig/kconfig/util.c +++ b/programs/src/kconfig_parser/kconfig/util.c diff --git a/programs/src/kconfig/kconfig/zconf.gperf b/programs/src/kconfig_parser/kconfig/zconf.gperf index b6ac02d..b6ac02d 100644 --- a/programs/src/kconfig/kconfig/zconf.gperf +++ b/programs/src/kconfig_parser/kconfig/zconf.gperf diff --git a/programs/src/kconfig/kconfig/zconf.hash.c b/programs/src/kconfig_parser/kconfig/zconf.hash.c index b8c1dfb..b8c1dfb 100644 --- a/programs/src/kconfig/kconfig/zconf.hash.c +++ b/programs/src/kconfig_parser/kconfig/zconf.hash.c diff --git a/programs/src/kconfig/kconfig/zconf.l b/programs/src/kconfig_parser/kconfig/zconf.l index 6c62d93..6c62d93 100644 --- a/programs/src/kconfig/kconfig/zconf.l +++ b/programs/src/kconfig_parser/kconfig/zconf.l diff --git a/programs/src/kconfig/kconfig/zconf.lex.c b/programs/src/kconfig_parser/kconfig/zconf.lex.c index e3b33bd..e3b33bd 100644 --- a/programs/src/kconfig/kconfig/zconf.lex.c +++ b/programs/src/kconfig_parser/kconfig/zconf.lex.c diff --git a/programs/src/kconfig/kconfig/zconf.tab.c b/programs/src/kconfig_parser/kconfig/zconf.tab.c index 0864c7d..0864c7d 100644 --- a/programs/src/kconfig/kconfig/zconf.tab.c +++ b/programs/src/kconfig_parser/kconfig/zconf.tab.c diff --git a/programs/src/kconfig/kconfig/zconf.y b/programs/src/kconfig_parser/kconfig/zconf.y index 0f683cf..0f683cf 100644 --- a/programs/src/kconfig/kconfig/zconf.y +++ b/programs/src/kconfig_parser/kconfig/zconf.y diff --git a/programs/src/kconfig/kconfig_parser.c b/programs/src/kconfig_parser/kconfig_parser.c index 4fac8b2..b757a8a 100644 --- a/programs/src/kconfig/kconfig_parser.c +++ b/programs/src/kconfig_parser/kconfig_parser.c @@ -28,7 +28,11 @@ int main(int argc, char **argv) { if (argc < 2) { printf("No input file specified\n"); - return; + exit(1); + } + if (argc < 3) { + printf("No output folder specified\n"); + exit(2); } setlocale(LC_ALL, ""); @@ -43,9 +47,11 @@ int main(int argc, char **argv) { kconfig_menu_walker(solve_names); kconfig_menu_walker(solve_dep); - //symlist_print(gsymlist); - fprint_rules(gsymlist); - fprint_linker(gsymlist); + char *rules_file, *symbol_map_file; + asprintf(&rules_file, "%s/%s", argv[2], DEFAULT_RULES_FILE); + asprintf(&symbol_map_file, "%s/%s", argv[2], DEFAULT_SYMBOL_MAP_FILE); + fprint_rules(gsymlist, rules_file); + fprint_symbol_map(gsymlist, symbol_map_file); } void kconfig_menu_walker(void (*solve) (struct symbol * sym)) { diff --git a/programs/src/kconfig/output.c b/programs/src/kconfig_parser/output.c index ed9daec..5dd848b 100644 --- a/programs/src/kconfig/output.c +++ b/programs/src/kconfig_parser/output.c @@ -1,10 +1,10 @@ #include "output.h" -void fprint_rules(struct symlist *sl) { +void fprint_rules(struct symlist *sl, char* output) { FILE *f; - f = fopen(RULES_FILE, "w"); + f = fopen(output, "w"); if (f == NULL) { - fprintf(stderr, "Can't create file: %s\n", RULES_FILE); + fprintf(stderr, "Can't create file: %s\n", output); return; } int i; @@ -67,16 +67,16 @@ void fprint_rules(struct symlist *sl) { fclose(f); } -void fprint_linker(struct symlist *sl) { +void fprint_symbol_map(struct symlist *sl, char* output) { FILE *f; - f = fopen(LINKER_FILE, "w"); + f = fopen(output, "w"); if (f == NULL) { - fprintf(stderr, "Can't create file: %s\n", RULES_FILE); + fprintf(stderr, "Can't create file: %s\n", output); return; } int i; for (i = 0; i < sl->pos; i++) { - fprintf(f, "%d:%s\n", sl->array[i].id, sl->array[i].name); + fprintf(f, "%d %s\n", sl->array[i].id, sl->array[i].name); } fclose(f); } diff --git a/programs/src/kconfig_parser/output.h b/programs/src/kconfig_parser/output.h new file mode 100644 index 0000000..a4686e3 --- /dev/null +++ b/programs/src/kconfig_parser/output.h @@ -0,0 +1,14 @@ +#ifndef _OUTPUT_H_ +#define _OUTPUT_H_ + +#include <stdlib.h> +#include <stdio.h> +#include "symlist.h" + +#define DEFAULT_RULES_FILE "rules" +#define DEFAULT_SYMBOL_MAP_FILE "symbol_map" + +void fprint_rules(struct symlist *sl, char* output); +void fprint_symbol_map(struct symlist *sl, char* output); + +#endif /* _OUTPUT_H_ */ diff --git a/programs/src/kconfig/symlist.c b/programs/src/kconfig_parser/symlist.c index 7dcd2c6..7dcd2c6 100644 --- a/programs/src/kconfig/symlist.c +++ b/programs/src/kconfig_parser/symlist.c diff --git a/programs/src/kconfig/symlist.h b/programs/src/kconfig_parser/symlist.h index caa827a..caa827a 100644 --- a/programs/src/kconfig/symlist.h +++ b/programs/src/kconfig_parser/symlist.h |