]> git.proxmox.com Git - grub2.git/blob - include/grub/normal.h
* grub-core/commands/testspeed.c: New command testspeed.
[grub2.git] / include / grub / normal.h
1 /* normal.h - prototypes for the normal mode */
2 /*
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2002,2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
5 *
6 * GRUB is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * GRUB is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef GRUB_NORMAL_HEADER
21 #define GRUB_NORMAL_HEADER 1
22
23 #include <grub/term.h>
24 #include <grub/symbol.h>
25 #include <grub/err.h>
26 #include <grub/env.h>
27 #include <grub/menu.h>
28 #include <grub/command.h>
29 #include <grub/file.h>
30
31 /* The standard left and right margin for some messages. */
32 #define STANDARD_MARGIN 6
33
34 /* The type of a completion item. */
35 enum grub_completion_type
36 {
37 GRUB_COMPLETION_TYPE_COMMAND,
38 GRUB_COMPLETION_TYPE_DEVICE,
39 GRUB_COMPLETION_TYPE_PARTITION,
40 GRUB_COMPLETION_TYPE_FILE,
41 GRUB_COMPLETION_TYPE_ARGUMENT
42 };
43 typedef enum grub_completion_type grub_completion_type_t;
44
45 extern struct grub_menu_viewer grub_normal_text_menu_viewer;
46 extern int grub_normal_exit_level;
47
48 /* Defined in `main.c'. */
49 void grub_enter_normal_mode (const char *config);
50 void grub_normal_execute (const char *config, int nested, int batch);
51 void grub_menu_init_page (int nested, int edit, int *num_entries,
52 struct grub_term_output *term);
53 void grub_normal_init_page (struct grub_term_output *term);
54 char *grub_file_getline (grub_file_t file);
55 void grub_cmdline_run (int nested);
56
57 /* Defined in `cmdline.c'. */
58 char *grub_cmdline_get (const char *prompt);
59 grub_err_t grub_set_history (int newsize);
60
61 /* Defined in `completion.c'. */
62 char *grub_normal_do_completion (char *buf, int *restore,
63 void (*hook) (const char *item, grub_completion_type_t type, int count));
64
65 /* Defined in `misc.c'. */
66 grub_err_t grub_normal_print_device_info (const char *name);
67
68 /* Defined in `color.c'. */
69 char *grub_env_write_color_normal (struct grub_env_var *var, const char *val);
70 char *grub_env_write_color_highlight (struct grub_env_var *var, const char *val);
71 int grub_parse_color_name_pair (grub_uint8_t *ret, const char *name);
72
73 /* Defined in `menu_text.c'. */
74 void grub_wait_after_message (void);
75 void
76 grub_print_ucs4 (const grub_uint32_t * str,
77 const grub_uint32_t * last_position,
78 int margin_left, int margin_right,
79 struct grub_term_output *term);
80
81 void
82 grub_print_ucs4_menu (const grub_uint32_t * str,
83 const grub_uint32_t * last_position,
84 int margin_left, int margin_right,
85 struct grub_term_output *term,
86 int skip_lines, int max_lines, grub_uint32_t contchar,
87 struct grub_term_pos *pos);
88 int
89 grub_ucs4_count_lines (const grub_uint32_t * str,
90 const grub_uint32_t * last_position,
91 int margin_left, int margin_right,
92 struct grub_term_output *term);
93 grub_ssize_t grub_getstringwidth (grub_uint32_t * str,
94 const grub_uint32_t * last_position,
95 struct grub_term_output *term);
96 void grub_print_message_indented (const char *msg, int margin_left,
97 int margin_right,
98 struct grub_term_output *term);
99 void
100 grub_menu_text_register_instances (int entry, grub_menu_t menu, int nested);
101 grub_err_t
102 grub_show_menu (grub_menu_t menu, int nested, int autobooted);
103
104 /* Defined in `handler.c'. */
105 void read_handler_list (void);
106 void free_handler_list (void);
107
108 /* Defined in `dyncmd.c'. */
109 void read_command_list (const char *prefix);
110
111 /* Defined in `autofs.c'. */
112 void read_fs_list (const char *prefix);
113
114 void grub_context_init (void);
115 void grub_context_fini (void);
116
117 void read_crypto_list (const char *prefix);
118
119 void read_terminal_list (const char *prefix);
120
121 void grub_set_more (int onoff);
122
123 void grub_normal_reset_more (void);
124
125 void grub_xputs_normal (const char *str);
126
127 extern int grub_extractor_level;
128
129 grub_err_t
130 grub_normal_add_menu_entry (int argc, const char **args, char **classes,
131 const char *id,
132 const char *users, const char *hotkey,
133 const char *prefix, const char *sourcecode,
134 int submenu);
135
136 grub_err_t
137 grub_normal_set_password (const char *user, const char *password);
138
139 void grub_normal_free_menu (grub_menu_t menu);
140
141 void grub_normal_auth_init (void);
142 void grub_normal_auth_fini (void);
143
144 void
145 grub_xnputs (const char *str, grub_size_t msg_len);
146
147 grub_command_t
148 grub_dyncmd_get_cmd (grub_command_t cmd);
149
150 void
151 grub_gettext_reread_prefix (const char *val);
152
153 enum grub_human_size_type
154 {
155 GRUB_HUMAN_SIZE_NORMAL,
156 GRUB_HUMAN_SIZE_SHORT,
157 GRUB_HUMAN_SIZE_SPEED,
158 };
159
160 const char *
161 grub_get_human_size (grub_uint64_t size, enum grub_human_size_type type);
162
163 #endif /* ! GRUB_NORMAL_HEADER */