]> andersk Git - moira.git/blame - clients/moira/menu.h
Initial revision
[moira.git] / clients / moira / menu.h
CommitLineData
e66cf6a1 1#define MAX_ARGC 16 /* Maximum argument count per line */
2#define MAX_ARGLEN 128 /* Maximum length of an argument */
3#define MAX_LINES 16 /* Maximum number of lines per menu */
4
5#define MAX_TITLE 1 /* Maximum length of title, in lines */
6
7/* Maximum depth to which submenus will be searched when looking for commands */
8#define MAX_MENU_DEPTH 8
9
10typedef struct menu_arg {
11 char *ma_doc; /* Short doc for completion */
12 char *ma_prompt; /* For prompting in menu */
13} Menu_Arg;
14
15typedef struct menu_line {
16 int (*ml_function) ();
17 struct menu *ml_submenu;
18 int ml_argc;
19 struct menu_arg ml_args[MAX_ARGC];
20} Menu_Line;
21
22#define ml_doc ml_args[0].ma_prompt
23#define ml_command ml_args[0].ma_doc
24
25typedef struct menu {
26 int (*m_entry) ();
27 int (*m_exit) ();
28 char *m_title;
29 int m_length;
30 struct menu_line m_lines[MAX_LINES];
31} Menu;
32
33/* Return codes for Do_menu */
34/* These should also be used by functions called from Do_menu */
35#define DM_NORMAL 0 /* Normal return */
36#define DM_QUIT 1 /* Quit; ^C or q command received */
37
38/* Macros for initializing menu lines */
39#define NULLFUNC ((int (*)()) 0)
40#define NULLMENU ((struct menu *) 0)
41#define SUBMENU(cmd, doc, menu) { NULLFUNC, menu, 1, { { cmd, doc } } }
42#define SIMPLEFUNC(cmd, doc, func) { func, NULLMENU, 1, { { cmd, doc } } }
This page took 0.051737 seconds and 5 git commands to generate.