normal.h 5.21 KB
Newer Older
1 2
/* normal.h - prototypes for the normal mode */
/*
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 10
 *  (at your option) any later version.
 *
11
 *  GRUB is distributed in the hope that it will be useful,
12 13 14 15 16
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  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 21
#ifndef GRUB_NORMAL_HEADER
#define GRUB_NORMAL_HEADER	1
22

23
#include <grub/term.h>
24 25
#include <grub/symbol.h>
#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 32 33
/* The standard left and right margin for some messages.  */
#define STANDARD_MARGIN 6

34 35 36 37 38 39 40
/* The type of a completion item.  */
enum grub_completion_type
  {
    GRUB_COMPLETION_TYPE_COMMAND,
    GRUB_COMPLETION_TYPE_DEVICE,
    GRUB_COMPLETION_TYPE_PARTITION,
    GRUB_COMPLETION_TYPE_FILE,
41
    GRUB_COMPLETION_TYPE_ARGUMENT
42 43 44
  };
typedef enum grub_completion_type grub_completion_type_t;

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 52 53 54 55 56 57 58 59 60 61 62 63 64 65
struct grub_term_screen_geometry
{
  /* The number of entries shown at a time.  */
  int num_entries;
  int first_entry_y;
  int first_entry_x;
  int entry_width;
  int timeout_y;
  int timeout_lines;
  int border;
  int right_margin;
};

void grub_menu_init_page (int nested, int edit,
			  struct grub_term_screen_geometry *geo,
66
			  struct grub_term_output *term);
67
void grub_normal_init_page (struct grub_term_output *term, int y);
68
char *grub_file_getline (grub_file_t file);
69
void grub_cmdline_run (int nested, int force_auth);
70 71

/* Defined in `cmdline.c'.  */
72
char *grub_cmdline_get (const char *prompt);
73
grub_err_t grub_set_history (int newsize);
74 75

/* Defined in `completion.c'.  */
76 77
char *grub_normal_do_completion (char *buf, int *restore,
				 void (*hook) (const char *item, grub_completion_type_t type, int count));
78 79

/* Defined in `misc.c'.  */
80
grub_err_t grub_normal_print_device_info (const char *name);
81 82

/* Defined in `color.c'.  */
83 84
char *grub_env_write_color_normal (struct grub_env_var *var, const char *val);
char *grub_env_write_color_highlight (struct grub_env_var *var, const char *val);
85
int grub_parse_color_name_pair (grub_uint8_t *ret, const char *name);
86 87

/* Defined in `menu_text.c'.  */
88
void grub_wait_after_message (void);
89 90 91 92 93
void
grub_print_ucs4 (const grub_uint32_t * str,
		 const grub_uint32_t * last_position,
		 int margin_left, int margin_right,
		 struct grub_term_output *term);
94 95 96 97 98 99 100 101

void
grub_print_ucs4_menu (const grub_uint32_t * str,
		      const grub_uint32_t * last_position,
		      int margin_left, int margin_right,
		      struct grub_term_output *term,
		      int skip_lines, int max_lines, grub_uint32_t contchar,
		      struct grub_term_pos *pos);
102 103 104 105 106
int
grub_ucs4_count_lines (const grub_uint32_t * str,
		       const grub_uint32_t * last_position,
		       int margin_left, int margin_right,
		       struct grub_term_output *term);
107 108 109
grub_size_t grub_getstringwidth (grub_uint32_t * str,
				 const grub_uint32_t * last_position,
				 struct grub_term_output *term);
110
void grub_print_message_indented (const char *msg, int margin_left,
111 112 113 114 115
				  int margin_right,
				  struct grub_term_output *term);
void
grub_menu_text_register_instances (int entry, grub_menu_t menu, int nested);
grub_err_t
116
grub_show_menu (grub_menu_t menu, int nested, int autobooted);
117

118
/* Defined in `handler.c'.  */
119 120
void read_handler_list (void);
void free_handler_list (void);
121 122

/* Defined in `dyncmd.c'.  */
123
void read_command_list (const char *prefix);
124 125

/* Defined in `autofs.c'.  */
126
void read_fs_list (const char *prefix);
127

128 129
void grub_context_init (void);
void grub_context_fini (void);
130

131
void read_crypto_list (const char *prefix);
132

133
void read_terminal_list (const char *prefix);
134

135
void grub_set_more (int onoff);
136

137
void grub_normal_reset_more (void);
138

139 140
void grub_xputs_normal (const char *str);

141
extern int grub_extractor_level;
142

143 144
grub_err_t
grub_normal_add_menu_entry (int argc, const char **args, char **classes,
145
			    const char *id,
146
			    const char *users, const char *hotkey,
147 148
			    const char *prefix, const char *sourcecode,
			    int submenu);
149

150 151 152
grub_err_t
grub_normal_set_password (const char *user, const char *password);

153 154
void grub_normal_free_menu (grub_menu_t menu);

155 156 157
void grub_normal_auth_init (void);
void grub_normal_auth_fini (void);

158 159 160
void
grub_xnputs (const char *str, grub_size_t msg_len);

161 162 163
grub_command_t
grub_dyncmd_get_cmd (grub_command_t cmd);

164 165 166
void
grub_gettext_reread_prefix (const char *val);

167 168 169 170 171 172 173
enum grub_human_size_type
  {
    GRUB_HUMAN_SIZE_NORMAL,
    GRUB_HUMAN_SIZE_SHORT,
    GRUB_HUMAN_SIZE_SPEED,
  };

174
const char *
175
grub_get_human_size (grub_uint64_t size, enum grub_human_size_type type);
176

177
#endif /* ! GRUB_NORMAL_HEADER */