vaseboot/include/VasEBoot/normal.h

178 lines
5.6 KiB
C

/* normal.h - prototypes for the normal mode */
/*
* VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VasEBoot is distributed in the hope that it will be useful,
* 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
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VasEBoot_NORMAL_HEADER
#define VasEBoot_NORMAL_HEADER 1
#include <VasEBoot/term.h>
#include <VasEBoot/symbol.h>
#include <VasEBoot/err.h>
#include <VasEBoot/env.h>
#include <VasEBoot/menu.h>
#include <VasEBoot/command.h>
#include <VasEBoot/file.h>
/* The standard left and right margin for some messages. */
#define STANDARD_MARGIN 6
/* The type of a completion item. */
enum VasEBoot_completion_type
{
VasEBoot_COMPLETION_TYPE_COMMAND,
VasEBoot_COMPLETION_TYPE_DEVICE,
VasEBoot_COMPLETION_TYPE_PARTITION,
VasEBoot_COMPLETION_TYPE_FILE,
VasEBoot_COMPLETION_TYPE_ARGUMENT
};
typedef enum VasEBoot_completion_type VasEBoot_completion_type_t;
extern struct VasEBoot_menu_viewer VasEBoot_normal_text_menu_viewer;
extern int VasEBoot_normal_exit_level;
/* Defined in `main.c'. */
void VasEBoot_enter_normal_mode (const char *config);
void VasEBoot_normal_execute (const char *config, int nested, int batch);
struct VasEBoot_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 VasEBoot_menu_init_page (int nested, int edit,
struct VasEBoot_term_screen_geometry *geo,
struct VasEBoot_term_output *term);
void VasEBoot_normal_init_page (struct VasEBoot_term_output *term, int y);
char *VasEBoot_file_getline (VasEBoot_file_t file);
void VasEBoot_cmdline_run (int nested, int force_auth);
/* Defined in `cmdline.c'. */
char *VasEBoot_cmdline_get (const char *prompt);
VasEBoot_err_t VasEBoot_set_history (int newsize);
/* Defined in `completion.c'. */
char *VasEBoot_normal_do_completion (char *buf, int *restore,
void (*hook) (const char *item, VasEBoot_completion_type_t type, int count));
/* Defined in `misc.c'. */
VasEBoot_err_t VasEBoot_normal_print_device_info (const char *name);
/* Defined in `color.c'. */
char *VasEBoot_env_write_color_normal (struct VasEBoot_env_var *var, const char *val);
char *VasEBoot_env_write_color_highlight (struct VasEBoot_env_var *var, const char *val);
int VasEBoot_parse_color_name_pair (VasEBoot_uint8_t *ret, const char *name);
/* Defined in `menu_text.c'. */
void VasEBoot_wait_after_message (void);
void
VasEBoot_print_ucs4 (const VasEBoot_uint32_t * str,
const VasEBoot_uint32_t * last_position,
int margin_left, int margin_right,
struct VasEBoot_term_output *term);
void
VasEBoot_print_ucs4_menu (const VasEBoot_uint32_t * str,
const VasEBoot_uint32_t * last_position,
int margin_left, int margin_right,
struct VasEBoot_term_output *term,
int skip_lines, int max_lines, VasEBoot_uint32_t contchar,
struct VasEBoot_term_pos *pos);
int
VasEBoot_ucs4_count_lines (const VasEBoot_uint32_t * str,
const VasEBoot_uint32_t * last_position,
int margin_left, int margin_right,
struct VasEBoot_term_output *term);
VasEBoot_size_t VasEBoot_getstringwidth (VasEBoot_uint32_t * str,
const VasEBoot_uint32_t * last_position,
struct VasEBoot_term_output *term);
void VasEBoot_print_message_indented (const char *msg, int margin_left,
int margin_right,
struct VasEBoot_term_output *term);
void
VasEBoot_menu_text_register_instances (int entry, VasEBoot_menu_t menu, int nested);
VasEBoot_err_t
VasEBoot_show_menu (VasEBoot_menu_t menu, int nested, int autobooted);
/* Defined in `handler.c'. */
void read_handler_list (void);
void free_handler_list (void);
/* Defined in `dyncmd.c'. */
void read_command_list (const char *prefix);
/* Defined in `autofs.c'. */
void read_fs_list (const char *prefix);
void VasEBoot_context_init (void);
void VasEBoot_context_fini (void);
void read_crypto_list (const char *prefix);
void read_terminal_list (const char *prefix);
void VasEBoot_set_more (int onoff);
void VasEBoot_normal_reset_more (void);
void VasEBoot_xputs_normal (const char *str);
extern int VasEBoot_extractor_level;
VasEBoot_err_t
VasEBoot_normal_add_menu_entry (int argc, const char **args, char **classes,
const char *id,
const char *users, const char *hotkey,
const char *prefix, const char *sourcecode,
int submenu);
VasEBoot_err_t
VasEBoot_normal_set_password (const char *user, const char *password);
void VasEBoot_normal_free_menu (VasEBoot_menu_t menu);
void VasEBoot_normal_auth_init (void);
void VasEBoot_normal_auth_fini (void);
void
VasEBoot_xnputs (const char *str, VasEBoot_size_t msg_len);
VasEBoot_command_t
VasEBoot_dyncmd_get_cmd (VasEBoot_command_t cmd);
void
VasEBoot_gettext_reread_prefix (const char *val);
enum VasEBoot_human_size_type
{
VasEBoot_HUMAN_SIZE_NORMAL,
VasEBoot_HUMAN_SIZE_SHORT,
VasEBoot_HUMAN_SIZE_SPEED,
};
const char *
VasEBoot_get_human_size (VasEBoot_uint64_t size, enum VasEBoot_human_size_type type);
#endif /* ! VasEBoot_NORMAL_HEADER */