terminfo.h 2.91 KB
Newer Older
1 2
/*
 *  GRUB  --  GRand Unified Bootloader
3
 *  Copyright (C) 2002,2003,2005,2007  Free Software Foundation, Inc.
4
 *
5
 *  GRUB is free software: you can redistribute it and/or modify
6
 *  it under the terms of the GNU General Public License as published by
7
 *  the Free Software Foundation, either version 3 of the License, or
8 9
 *  (at your option) any later version.
 *
10
 *  GRUB is distributed in the hope that it will be useful,
11 12 13 14 15
 *  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
16
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
17 18 19 20 21 22 23
 */

#ifndef GRUB_TERMINFO_HEADER
#define GRUB_TERMINFO_HEADER	1

#include <grub/err.h>
#include <grub/types.h>
24
#include <grub/term.h>
25

26 27 28
char *EXPORT_FUNC(grub_terminfo_get_current) (struct grub_term_output *term);
grub_err_t EXPORT_FUNC(grub_terminfo_set_current) (struct grub_term_output *term,
												const char *);
29

30
#define GRUB_TERMINFO_READKEY_MAX_LEN 6
31 32 33 34
struct grub_terminfo_input_state
{
  int input_buf[GRUB_TERMINFO_READKEY_MAX_LEN];
  int npending;
35
#if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275)
36 37 38
  int last_key;
  grub_uint64_t last_key_time;
#endif
39
  int (*readkey) (struct grub_term_input *term);
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
};

struct grub_terminfo_output_state
{
  struct grub_term_output *next;

  char *name;

  char *gotoxy;
  char *cls;
  char *reverse_video_on;
  char *reverse_video_off;
  char *cursor_on;
  char *cursor_off;
  char *setcolor;

56 57
  struct grub_term_coordinate size;
  struct grub_term_coordinate pos;
58

59
  void (*put) (struct grub_term_output *term, const int c);
60 61
};

62
grub_err_t EXPORT_FUNC(grub_terminfo_output_init) (struct grub_term_output *term);
63
void EXPORT_FUNC(grub_terminfo_gotoxy) (grub_term_output_t term,
64
					struct grub_term_coordinate pos);
65
void EXPORT_FUNC(grub_terminfo_cls) (grub_term_output_t term);
66
struct grub_term_coordinate EXPORT_FUNC (grub_terminfo_getxy) (struct grub_term_output *term);
67 68 69 70 71 72 73 74 75 76
void EXPORT_FUNC (grub_terminfo_setcursor) (struct grub_term_output *term,
					    const int on);
void EXPORT_FUNC (grub_terminfo_setcolorstate) (struct grub_term_output *term,
				  const grub_term_color_state state);


grub_err_t EXPORT_FUNC (grub_terminfo_input_init) (struct grub_term_input *term);
int EXPORT_FUNC (grub_terminfo_getkey) (struct grub_term_input *term);
void EXPORT_FUNC (grub_terminfo_putchar) (struct grub_term_output *term,
					  const struct grub_unicode_glyph *c);
77
struct grub_term_coordinate EXPORT_FUNC (grub_terminfo_getwh) (struct grub_term_output *term);
78

79 80 81 82

grub_err_t EXPORT_FUNC (grub_terminfo_output_register) (struct grub_term_output *term,
							const char *type);
grub_err_t EXPORT_FUNC (grub_terminfo_output_unregister) (struct grub_term_output *term);
83

84 85 86
void grub_terminfo_init (void);
void grub_terminfo_fini (void);

87
#endif /* ! GRUB_TERMINFO_HEADER */