normal.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. #ifndef GRUB_NORMAL_HEADER
  20. #define GRUB_NORMAL_HEADER 1
  21. #include <grub/term.h>
  22. #include <grub/symbol.h>
  23. #include <grub/err.h>
  24. #include <grub/env.h>
  25. #include <grub/menu.h>
  26. #include <grub/command.h>
  27. #include <grub/file.h>
  28. /* The standard left and right margin for some messages. */
  29. #define STANDARD_MARGIN 6
  30. /* The type of a completion item. */
  31. enum grub_completion_type
  32. {
  33. GRUB_COMPLETION_TYPE_COMMAND,
  34. GRUB_COMPLETION_TYPE_DEVICE,
  35. GRUB_COMPLETION_TYPE_PARTITION,
  36. GRUB_COMPLETION_TYPE_FILE,
  37. GRUB_COMPLETION_TYPE_ARGUMENT
  38. };
  39. typedef enum grub_completion_type grub_completion_type_t;
  40. extern struct grub_menu_viewer grub_normal_text_menu_viewer;
  41. extern int grub_normal_exit_level;
  42. /* Defined in `main.c'. */
  43. void grub_enter_normal_mode (const char *config);
  44. void grub_normal_execute (const char *config, int nested, int batch);
  45. struct grub_term_screen_geometry
  46. {
  47. /* The number of entries shown at a time. */
  48. int num_entries;
  49. int first_entry_y;
  50. int first_entry_x;
  51. int entry_width;
  52. int timeout_y;
  53. int timeout_lines;
  54. int border;
  55. int right_margin;
  56. };
  57. void grub_menu_init_page (int nested, int edit,
  58. struct grub_term_screen_geometry *geo,
  59. struct grub_term_output *term);
  60. void grub_normal_init_page (struct grub_term_output *term, int y);
  61. char *grub_file_getline (grub_file_t file);
  62. void grub_cmdline_run (int nested, int force_auth);
  63. /* Defined in `cmdline.c'. */
  64. char *grub_cmdline_get (const char *prompt);
  65. grub_err_t grub_set_history (int newsize);
  66. /* Defined in `completion.c'. */
  67. char *grub_normal_do_completion (char *buf, int *restore,
  68. void (*hook) (const char *item, grub_completion_type_t type, int count));
  69. /* Defined in `misc.c'. */
  70. grub_err_t grub_normal_print_device_info (const char *name);
  71. /* Defined in `color.c'. */
  72. char *grub_env_write_color_normal (struct grub_env_var *var, const char *val);
  73. char *grub_env_write_color_highlight (struct grub_env_var *var, const char *val);
  74. int grub_parse_color_name_pair (grub_uint8_t *ret, const char *name);
  75. /* Defined in `menu_text.c'. */
  76. void grub_wait_after_message (void);
  77. void
  78. grub_print_ucs4 (const grub_uint32_t * str,
  79. const grub_uint32_t * last_position,
  80. int margin_left, int margin_right,
  81. struct grub_term_output *term);
  82. void
  83. grub_print_ucs4_menu (const grub_uint32_t * str,
  84. const grub_uint32_t * last_position,
  85. int margin_left, int margin_right,
  86. struct grub_term_output *term,
  87. int skip_lines, int max_lines, grub_uint32_t contchar,
  88. struct grub_term_pos *pos);
  89. int
  90. grub_ucs4_count_lines (const grub_uint32_t * str,
  91. const grub_uint32_t * last_position,
  92. int margin_left, int margin_right,
  93. struct grub_term_output *term);
  94. grub_size_t grub_getstringwidth (grub_uint32_t * str,
  95. const grub_uint32_t * last_position,
  96. struct grub_term_output *term);
  97. void grub_print_message_indented (const char *msg, int margin_left,
  98. int margin_right,
  99. struct grub_term_output *term);
  100. void
  101. grub_menu_text_register_instances (int entry, grub_menu_t menu, int nested);
  102. grub_err_t
  103. grub_show_menu (grub_menu_t menu, int nested, int autobooted);
  104. /* Defined in `handler.c'. */
  105. void read_handler_list (void);
  106. void free_handler_list (void);
  107. /* Defined in `dyncmd.c'. */
  108. void read_command_list (const char *prefix);
  109. /* Defined in `autofs.c'. */
  110. void read_fs_list (const char *prefix);
  111. void grub_context_init (void);
  112. void grub_context_fini (void);
  113. void read_crypto_list (const char *prefix);
  114. void read_terminal_list (const char *prefix);
  115. void grub_set_more (int onoff);
  116. void grub_normal_reset_more (void);
  117. void grub_xputs_normal (const char *str);
  118. extern int grub_extractor_level;
  119. grub_err_t
  120. grub_normal_add_menu_entry (int argc, const char **args, char **classes,
  121. const char *id,
  122. const char *users, const char *hotkey,
  123. const char *prefix, const char *sourcecode,
  124. int submenu);
  125. grub_err_t
  126. grub_normal_set_password (const char *user, const char *password);
  127. void grub_normal_free_menu (grub_menu_t menu);
  128. void grub_normal_auth_init (void);
  129. void grub_normal_auth_fini (void);
  130. void
  131. grub_xnputs (const char *str, grub_size_t msg_len);
  132. grub_command_t
  133. grub_dyncmd_get_cmd (grub_command_t cmd);
  134. void
  135. grub_gettext_reread_prefix (const char *val);
  136. enum grub_human_size_type
  137. {
  138. GRUB_HUMAN_SIZE_NORMAL,
  139. GRUB_HUMAN_SIZE_SHORT,
  140. GRUB_HUMAN_SIZE_SPEED,
  141. };
  142. const char *
  143. grub_get_human_size (grub_uint64_t size, enum grub_human_size_type type);
  144. #endif /* ! GRUB_NORMAL_HEADER */