Diff for ep/src/menu.c between version 1.6 and 1.7
| version 1.6, 2002/02/21 02:22:00 |
version 1.7, 2002/02/25 18:45:53 |
| Line 82 typedef struct MENU_STRUCT { |
|
| Line 82 typedef struct MENU_STRUCT { |
|
| } menu; |
} menu; |
| |
|
| static void |
static void |
| free_menu(menu *m) |
free_menu(m) |
| |
menu *m; |
| { |
{ |
| if (!m) { |
if (!m) { |
| #ifdef DEBUG |
#ifdef DEBUG |
|
|
| */ |
*/ |
| |
|
| static int |
static int |
| confirm_args(char *prompt, char *format, va_list args) |
confirm_args(prompt, format, args) |
| |
char *prompt; |
| |
char *format; |
| |
va_list args; |
| { |
{ |
| int c; |
int c; |
| |
|
| Line 127 confirm_args(char *prompt, char *format, |
|
| Line 131 confirm_args(char *prompt, char *format, |
|
| } |
} |
| |
|
| static void |
static void |
| confirm_error(char *format, ...) |
confirm_error( |
| |
char *format, |
| |
...) |
| { |
{ |
| va_list args; |
va_list args; |
| |
|
| Line 137 confirm_error(char *format, ...) |
|
| Line 143 confirm_error(char *format, ...) |
|
| } |
} |
| |
|
| static int |
static int |
| confirm(char *prompt, char *format, ...) |
confirm( |
| |
char *prompt, |
| |
char *format, |
| |
...) |
| { |
{ |
| va_list args; |
va_list args; |
| int c; |
int c; |
| Line 149 confirm(char *prompt, char *format, ...) |
|
| Line 158 confirm(char *prompt, char *format, ...) |
|
| } |
} |
| |
|
| static void |
static void |
| menu_print_option(menu *m, int n, int selected) |
menu_print_option(m, n, selected) |
| |
menu *m; |
| |
int n; |
| |
int selected; |
| { |
{ |
| int k=0; |
int k=0; |
| option *o = &m->options[n]; |
option *o = &m->options[n]; |
| Line 211 menu_print_option(menu *m, int n, int se |
|
| Line 223 menu_print_option(menu *m, int n, int se |
|
| } |
} |
| |
|
| static void |
static void |
| menu_print(menu *m) |
menu_print(m) |
| |
menu *m; |
| { |
{ |
| int i; |
int i; |
| chtype hbox = '-', vbox = '|'; |
chtype hbox = '-', vbox = '|'; |
| Line 223 menu_print(menu *m) |
|
| Line 236 menu_print(menu *m) |
|
| } |
} |
| |
|
| static void |
static void |
| popup_menu_print_option(menu *m, int n, int selected) |
popup_menu_print_option(m, n, selected) |
| |
menu *m; |
| |
int n; |
| |
int selected; |
| { |
{ |
| option *o = &m->options[n]; |
option *o = &m->options[n]; |
| |
|
| Line 237 popup_menu_print_option(menu *m, int n, |
|
| Line 253 popup_menu_print_option(menu *m, int n, |
|
| } |
} |
| |
|
| static void |
static void |
| popup_menu_print(menu *m) |
popup_menu_print(m) |
| |
menu *m; |
| { |
{ |
| int i; |
int i; |
| option *o = &m->options[m->nitems-1]; |
option *o = &m->options[m->nitems-1]; |
| Line 251 popup_menu_print(menu *m) |
|
| Line 268 popup_menu_print(menu *m) |
|
| } |
} |
| |
|
| static int |
static int |
| do_menu(int type, PROCTABLE *p_ptbl, option items[], int y, int x) |
do_menu(type, p_ptbl, items, y, x) |
| |
int type; |
| |
PROCTABLE *p_ptbl; |
| |
option items[]; |
| |
int y; |
| |
int x; |
| { |
{ |
| int i; |
int i; |
| option *pom = items; |
option *pom = items; |
|
|
| } /* end do_menu() */ |
} /* end do_menu() */ |
| |
|
| static int |
static int |
| void_exit(PROCTABLE *p_ptbl, int y, int x) |
void_exit(p_ptbl, y, x) |
| |
PROCTABLE *p_ptbl; |
| |
int y; |
| |
int x; |
| { |
{ |
| // touchwin(stdscr); |
// touchwin(stdscr); |
| refresh(); |
refresh(); |
| Line 505 void_exit(PROCTABLE *p_ptbl, int y, int |
|
| Line 530 void_exit(PROCTABLE *p_ptbl, int y, int |
|
| |
|
| option menu_file_option[] = { |
option menu_file_option[] = { |
| { 'x', "Exit", "q", void_exit }, |
{ 'x', "Exit", "q", void_exit }, |
| {0, NULL, NULL, NULL} |
{ 0, NULL, NULL, NULL } |
| }; |
}; |
| |
|
| static int |
static int |
| file_menu(PROCTABLE *p_ptbl, int y, int x) |
file_menu(p_ptbl, y, x) |
| |
PROCTABLE *p_ptbl; |
| |
int y; |
| |
int x; |
| { |
{ |
| return do_menu(STANDARD_MENU, p_ptbl, menu_file_option, y, x); |
return do_menu(STANDARD_MENU, p_ptbl, menu_file_option, y, x); |
| } |
} |
| Line 517 file_menu(PROCTABLE *p_ptbl, int y, int |
|
| Line 545 file_menu(PROCTABLE *p_ptbl, int y, int |
|
| option menu_memory_option[] = { |
option menu_memory_option[] = { |
| { 'm', "Me&mory", "M", menu_memory_info }, |
{ 'm', "Me&mory", "M", menu_memory_info }, |
| { 'p', "Proc&table", "P", menu_proctable_info }, |
{ 'p', "Proc&table", "P", menu_proctable_info }, |
| {0, NULL, NULL, NULL} |
{ 0, NULL, NULL, NULL } |
| }; |
}; |
| |
|
| static int |
static int |
| memory_menu(PROCTABLE *p_ptbl, int y, int x) |
memory_menu(p_ptbl, y, x) |
| |
PROCTABLE *p_ptbl; |
| |
int y; |
| |
int x; |
| { |
{ |
| return do_menu(STANDARD_MENU, p_ptbl, menu_memory_option, y, x); |
return do_menu(STANDARD_MENU, p_ptbl, menu_memory_option, y, x); |
| } |
} |
| Line 532 option menu_setup_option[] = { |
|
| Line 563 option menu_setup_option[] = { |
|
| { '!', "Proc&table", "", void_exit }, |
{ '!', "Proc&table", "", void_exit }, |
| { '!', "&I/O", "", void_exit }, |
{ '!', "&I/O", "", void_exit }, |
| { '!', "&Memory menu", "", memory_menu }, |
{ '!', "&Memory menu", "", memory_menu }, |
| {0, NULL, NULL, NULL} |
{ 0, NULL, NULL, NULL } |
| }; |
}; |
| |
|
| static int |
static int |
| setup_menu(PROCTABLE *p_ptbl, int y, int x) |
setup_menu(p_ptbl, y, x) |
| |
PROCTABLE *p_ptbl; |
| |
int y; |
| |
int x; |
| { |
{ |
| return do_menu(STANDARD_MENU, p_ptbl, menu_setup_option, y, x); |
return do_menu(STANDARD_MENU, p_ptbl, menu_setup_option, y, x); |
| } |
} |
| Line 546 option menu_help_option[] = { |
|
| Line 580 option menu_help_option[] = { |
|
| { '?', "&Keys", "", void_exit }, |
{ '?', "&Keys", "", void_exit }, |
| { '?', "User's &manual", "", void_exit }, |
{ '?', "User's &manual", "", void_exit }, |
| { '?', "&Copying", "", void_exit }, |
{ '?', "&Copying", "", void_exit }, |
| {0, NULL, NULL, NULL} |
{ 0, NULL, NULL, NULL } |
| }; |
}; |
| |
|
| static int |
static int |
| help_menu(PROCTABLE *p_ptbl, int y, int x) |
help_menu(p_ptbl, y, x) |
| |
PROCTABLE *p_ptbl; |
| |
int y; |
| |
int x; |
| { |
{ |
| return do_menu(STANDARD_MENU, p_ptbl, menu_help_option, y, x); |
return do_menu(STANDARD_MENU, p_ptbl, menu_help_option, y, x); |
| } |
} |
| Line 563 option popup_menu_main_option[] = { |
|
| Line 600 option popup_menu_main_option[] = { |
|
| { 0, NULL, NULL, NULL } |
{ 0, NULL, NULL, NULL } |
| }; |
}; |
| |
|
| int menu_main(PROCTABLE *p_ptbl) |
int |
| |
menu_main(p_ptbl) |
| |
PROCTABLE *p_ptbl; |
| { |
{ |
| return do_menu(POPUP_MENU, p_ptbl, popup_menu_main_option, 0, 0); |
return do_menu(POPUP_MENU, p_ptbl, popup_menu_main_option, 0, 0); |
| } |
} |
| |
|
| void menu_curses_init(void) |
void |
| |
menu_curses_init(void) |
| { |
{ |
| initscr(); |
initscr(); |
| clear(); |
clear(); |
| Line 582 void menu_curses_init(void) |
|
| Line 622 void menu_curses_init(void) |
|
| } |
} |
| |
|
| #if defined(SELF) || defined(SELFTEST) |
#if defined(SELF) || defined(SELFTEST) |
| int main(int argc, char *argv[]) |
int |
| |
main(argc, argv) |
| |
int argc; |
| |
char **argv; |
| { |
{ |
| fd_set fds; |
fd_set fds; |
| int c; |
int c; |
Platon Group <platon@platon.org> http://platon.org/
|
|