From 62d21b8b34727434cc6340caf47fe7e34636d507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 7 May 2015 13:31:09 +0200 Subject: Rename setpermute to permute --- scripts/permute/.gitignore | 1 + scripts/permute/Makefile | 23 +++++++ scripts/permute/constlist.h | 7 +++ scripts/permute/menudata.h | 16 +++++ scripts/permute/permute.c | 132 +++++++++++++++++++++++++++++++++++++++ scripts/permute/permutelist.h | 17 +++++ scripts/setpermute/Makefile | 23 ------- scripts/setpermute/constlist.h | 7 --- scripts/setpermute/menudata.h | 16 ----- scripts/setpermute/permutelist.h | 17 ----- scripts/setpermute/setpermute | Bin 130181 -> 0 bytes scripts/setpermute/setpermute.c | 132 --------------------------------------- 12 files changed, 196 insertions(+), 195 deletions(-) create mode 100644 scripts/permute/.gitignore create mode 100644 scripts/permute/Makefile create mode 100644 scripts/permute/constlist.h create mode 100644 scripts/permute/menudata.h create mode 100644 scripts/permute/permute.c create mode 100644 scripts/permute/permutelist.h delete mode 100644 scripts/setpermute/Makefile delete mode 100644 scripts/setpermute/constlist.h delete mode 100644 scripts/setpermute/menudata.h delete mode 100644 scripts/setpermute/permutelist.h delete mode 100755 scripts/setpermute/setpermute delete mode 100644 scripts/setpermute/setpermute.c diff --git a/scripts/permute/.gitignore b/scripts/permute/.gitignore new file mode 100644 index 0000000..4456899 --- /dev/null +++ b/scripts/permute/.gitignore @@ -0,0 +1 @@ +permute diff --git a/scripts/permute/Makefile b/scripts/permute/Makefile new file mode 100644 index 0000000..3c25c99 --- /dev/null +++ b/scripts/permute/Makefile @@ -0,0 +1,23 @@ +MAKEFLAGS += --no-builtin-rules +.PHONY: all clean +.SUFFIXES: + +all: setpermute + +KCONFIG_PREFIX = ../shared/kconfig +include $(KCONFIG_PREFIX)/files.mk + +SRC = permute.c +OBJ = $(patsubst %.c,%.o,$(SRC)) +CFLAGS = -O0 -Wall -ggdb -DDEBUG +INCLUDES = -I../shared + +%.o: %.c + gcc -c $(CFLAGS) -o $@ $^ $(INCLUDES) + +permute: $(OBJ) $(KCONFIG_OBJ) + gcc -o $@ $^ + +clean:: + $(RM) $(OBJ) + $(RM) setpermute diff --git a/scripts/permute/constlist.h b/scripts/permute/constlist.h new file mode 100644 index 0000000..01f172a --- /dev/null +++ b/scripts/permute/constlist.h @@ -0,0 +1,7 @@ +#include +#include + +#ifndef _CONSTLIST_H_ +#define _CONSTLIST_H_ + +#endif /* _CONSTLIST_H_ */ diff --git a/scripts/permute/menudata.h b/scripts/permute/menudata.h new file mode 100644 index 0000000..1369106 --- /dev/null +++ b/scripts/permute/menudata.h @@ -0,0 +1,16 @@ +#include +#include +#include +#include + +#ifndef _MENUDATA_H_ +#define _MENUDATA_H_ + +struct menudata { + bool permute; + bool subpermute; +}; + +bool menudata_cal_subpermute(struct menu *m); + +#endif /* _MENUDATA_H_ */ diff --git a/scripts/permute/permute.c b/scripts/permute/permute.c new file mode 100644 index 0000000..fc1221c --- /dev/null +++ b/scripts/permute/permute.c @@ -0,0 +1,132 @@ +#include +#include +#include +#include +#include + +#include +#include +#include + +#define INPUT_SIZE 1024 + +int verbose_level; +char *file, *folder; + +void printf_help(); + +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); + conf_read(".config"); + + struct menu *wroot, *wmenu, *wwmenu; + wroot = &rootmenu; + unsigned menucount; + char *input; + int inputi; + input = malloc(INPUT_SIZE * sizeof(char)); + + printf_help(); + + while (1) { + printf("\n%s\n", wroot->prompt->text); + wmenu = wroot->list; + menucount = 0; + while (wmenu != NULL) { + if (wmenu->prompt != NULL) { + if (wmenu->list == NULL) + printf("%3d: %s\n", ++menucount, + wmenu->prompt->text); + else + printf("%3d: %s -->\n", ++menucount, + wmenu->prompt->text); + } + wmenu = wmenu->next; + } + + input: + printf("Input: "); + fgets(input, INPUT_SIZE, stdin); + switch (input[0]) { + case 'e': + case 'v': + case 'f': + inputi = atoi(input + 1); + if (inputi <= 0 && inputi > menucount) + goto input; + int y = 0; + wwmenu = wroot->list; + while (1) { + if (wwmenu->prompt != NULL) + y++; + if (y >= inputi) + break; + wwmenu = wwmenu->next; + } + break; + case 'u': + wmenu = wmenu->parent; + break; + case 'r': + break; + case 'q': + goto quit; + case 'h': + printf_help(); + default: + goto input; + } + switch (input[0]) { + case 'e': + wroot = wwmenu; + break; + case 'v': + break; + case 'f': + break; + } + } + + quit: + + return 0; +} + +void printf_help() { + printf("As input are accepted these commands:\n"); + printf(" e Enter menu according to number.\n"); + printf(" u Go to previous upper menu.\n"); + printf(" v Set menu and all its submenus as variable.\n"); + printf(" f Set menu and all its submenus as fixed.\n"); + printf(" r Reprint menu.\n"); + printf(" h Prints this text.\n"); + printf(" q Quit this program\n"); +} diff --git a/scripts/permute/permutelist.h b/scripts/permute/permutelist.h new file mode 100644 index 0000000..725f6d6 --- /dev/null +++ b/scripts/permute/permutelist.h @@ -0,0 +1,17 @@ +#include +#include +#include + +#ifndef _PERMUTELIST_H_ +#define _PERMUTELIST_H_ + +struct permutelist { + struct menu *permute; + size_t size, pos; +}; + +void permutelist_add(struct menu *m); +void permutelist_remove(struct menu *m); +bool permutelist_is_permute(struct menu *m); + +#endif /* _PERMUTELIST_H_ */ diff --git a/scripts/setpermute/Makefile b/scripts/setpermute/Makefile deleted file mode 100644 index 734a12e..0000000 --- a/scripts/setpermute/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -MAKEFLAGS += --no-builtin-rules -.PHONY: all clean -.SUFFIXES: - -all: setpermute - -KCONFIG_PREFIX = ../shared/kconfig -include $(KCONFIG_PREFIX)/files.mk - -SRC = setpermute.c -OBJ = $(patsubst %.c,%.o,$(SRC)) -CFLAGS = -O0 -Wall -ggdb -DDEBUG -INCLUDES = -I../shared - -%.o: %.c - gcc -c $(CFLAGS) -o $@ $^ $(INCLUDES) - -setpermute: $(OBJ) $(KCONFIG_OBJ) - gcc -o $@ $^ - -clean:: - $(RM) $(OBJ) - $(RM) setpermute diff --git a/scripts/setpermute/constlist.h b/scripts/setpermute/constlist.h deleted file mode 100644 index 01f172a..0000000 --- a/scripts/setpermute/constlist.h +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include - -#ifndef _CONSTLIST_H_ -#define _CONSTLIST_H_ - -#endif /* _CONSTLIST_H_ */ diff --git a/scripts/setpermute/menudata.h b/scripts/setpermute/menudata.h deleted file mode 100644 index 1369106..0000000 --- a/scripts/setpermute/menudata.h +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include -#include - -#ifndef _MENUDATA_H_ -#define _MENUDATA_H_ - -struct menudata { - bool permute; - bool subpermute; -}; - -bool menudata_cal_subpermute(struct menu *m); - -#endif /* _MENUDATA_H_ */ diff --git a/scripts/setpermute/permutelist.h b/scripts/setpermute/permutelist.h deleted file mode 100644 index 725f6d6..0000000 --- a/scripts/setpermute/permutelist.h +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include -#include - -#ifndef _PERMUTELIST_H_ -#define _PERMUTELIST_H_ - -struct permutelist { - struct menu *permute; - size_t size, pos; -}; - -void permutelist_add(struct menu *m); -void permutelist_remove(struct menu *m); -bool permutelist_is_permute(struct menu *m); - -#endif /* _PERMUTELIST_H_ */ diff --git a/scripts/setpermute/setpermute b/scripts/setpermute/setpermute deleted file mode 100755 index f568a9d..0000000 Binary files a/scripts/setpermute/setpermute and /dev/null differ diff --git a/scripts/setpermute/setpermute.c b/scripts/setpermute/setpermute.c deleted file mode 100644 index fc1221c..0000000 --- a/scripts/setpermute/setpermute.c +++ /dev/null @@ -1,132 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include -#include - -#define INPUT_SIZE 1024 - -int verbose_level; -char *file, *folder; - -void printf_help(); - -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); - conf_read(".config"); - - struct menu *wroot, *wmenu, *wwmenu; - wroot = &rootmenu; - unsigned menucount; - char *input; - int inputi; - input = malloc(INPUT_SIZE * sizeof(char)); - - printf_help(); - - while (1) { - printf("\n%s\n", wroot->prompt->text); - wmenu = wroot->list; - menucount = 0; - while (wmenu != NULL) { - if (wmenu->prompt != NULL) { - if (wmenu->list == NULL) - printf("%3d: %s\n", ++menucount, - wmenu->prompt->text); - else - printf("%3d: %s -->\n", ++menucount, - wmenu->prompt->text); - } - wmenu = wmenu->next; - } - - input: - printf("Input: "); - fgets(input, INPUT_SIZE, stdin); - switch (input[0]) { - case 'e': - case 'v': - case 'f': - inputi = atoi(input + 1); - if (inputi <= 0 && inputi > menucount) - goto input; - int y = 0; - wwmenu = wroot->list; - while (1) { - if (wwmenu->prompt != NULL) - y++; - if (y >= inputi) - break; - wwmenu = wwmenu->next; - } - break; - case 'u': - wmenu = wmenu->parent; - break; - case 'r': - break; - case 'q': - goto quit; - case 'h': - printf_help(); - default: - goto input; - } - switch (input[0]) { - case 'e': - wroot = wwmenu; - break; - case 'v': - break; - case 'f': - break; - } - } - - quit: - - return 0; -} - -void printf_help() { - printf("As input are accepted these commands:\n"); - printf(" e Enter menu according to number.\n"); - printf(" u Go to previous upper menu.\n"); - printf(" v Set menu and all its submenus as variable.\n"); - printf(" f Set menu and all its submenus as fixed.\n"); - printf(" r Reprint menu.\n"); - printf(" h Prints this text.\n"); - printf(" q Quit this program\n"); -} -- cgit v1.2.3