Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
[oweals/u-boot.git] / scripts / kconfig / nconf.h
1 /*
2  * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com?
3  * Released under the terms of the GNU GPL v2.0.
4  *
5  * Derived from menuconfig.
6  *
7  */
8
9 #include <ctype.h>
10 #include <errno.h>
11 #include <fcntl.h>
12 #include <limits.h>
13 #include <stdarg.h>
14 #include <stdlib.h>
15 #include <string.h>
16 #include <unistd.h>
17 #include <ncurses.h>
18 #include <menu.h>
19 #include <panel.h>
20 #include <form.h>
21
22 #include <stdio.h>
23 #include <time.h>
24 #include <sys/time.h>
25
26 #define max(a, b) ({\
27                 typeof(a) _a = a;\
28                 typeof(b) _b = b;\
29                 _a > _b ? _a : _b; })
30
31 #define min(a, b) ({\
32                 typeof(a) _a = a;\
33                 typeof(b) _b = b;\
34                 _a < _b ? _a : _b; })
35
36 typedef enum {
37         NORMAL = 1,
38         MAIN_HEADING,
39         MAIN_MENU_BOX,
40         MAIN_MENU_FORE,
41         MAIN_MENU_BACK,
42         MAIN_MENU_GREY,
43         MAIN_MENU_HEADING,
44         SCROLLWIN_TEXT,
45         SCROLLWIN_HEADING,
46         SCROLLWIN_BOX,
47         DIALOG_TEXT,
48         DIALOG_MENU_FORE,
49         DIALOG_MENU_BACK,
50         DIALOG_BOX,
51         INPUT_BOX,
52         INPUT_HEADING,
53         INPUT_TEXT,
54         INPUT_FIELD,
55         FUNCTION_TEXT,
56         FUNCTION_HIGHLIGHT,
57         ATTR_MAX
58 } attributes_t;
59 extern attributes_t attributes[];
60
61 typedef enum {
62         F_HELP = 1,
63         F_SYMBOL = 2,
64         F_INSTS = 3,
65         F_CONF = 4,
66         F_BACK = 5,
67         F_SAVE = 6,
68         F_LOAD = 7,
69         F_SEARCH = 8,
70         F_EXIT = 9,
71 } function_key;
72
73 void set_colors(void);
74
75 /* this changes the windows attributes !!! */
76 void print_in_middle(WINDOW *win,
77                 int starty,
78                 int startx,
79                 int width,
80                 const char *string,
81                 chtype color);
82 int get_line_length(const char *line);
83 int get_line_no(const char *text);
84 const char *get_line(const char *text, int line_no);
85 void fill_window(WINDOW *win, const char *text);
86 int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...);
87 int dialog_inputbox(WINDOW *main_window,
88                 const char *title, const char *prompt,
89                 const char *init, char **resultp, int *result_len);
90 void refresh_all_windows(WINDOW *main_window);
91 void show_scroll_win(WINDOW *main_window,
92                 const char *title,
93                 const char *text);