1 /* term_console.c - console input and output */
2 /*
3  *  GRUB  --  GRand Unified Bootloader
4  *  Copyright (C) 2002  Free Software Foundation, Inc.
5  *
6  *  This program 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 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program 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 this program; if not, write to the Free Software
18  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */
20 
21 #include <shared.h>
22 #include <term.h>
23 
24 /* These functions are defined in asm.S instead of this file:
25    console_putchar, console_checkkey, console_getkey, console_getxy,
26    console_gotoxy, console_cls, and console_nocursor.  */
27 
28 int console_current_color = A_NORMAL;
29 static int console_standard_color = A_NORMAL;
30 static int console_normal_color = A_NORMAL;
31 static int console_highlight_color = A_REVERSE;
32 static color_state console_color_state = COLOR_STATE_STANDARD;
33 
34 void
console_setcolorstate(color_state state)35 console_setcolorstate (color_state state)
36 {
37   switch (state) {
38     case COLOR_STATE_STANDARD:
39       console_current_color = console_standard_color;
40       break;
41     case COLOR_STATE_NORMAL:
42       console_current_color = console_normal_color;
43       break;
44     case COLOR_STATE_HIGHLIGHT:
45       console_current_color = console_highlight_color;
46       break;
47     default:
48       console_current_color = console_standard_color;
49       break;
50   }
51 
52   console_color_state = state;
53 }
54 
55 void
console_setcolor(int normal_color,int highlight_color)56 console_setcolor (int normal_color, int highlight_color)
57 {
58   console_normal_color = normal_color;
59   console_highlight_color = highlight_color;
60 
61   console_setcolorstate (console_color_state);
62 }
63