17c478bd9Sstevel@tonic-gate /* term_console.c - console input and output */
27c478bd9Sstevel@tonic-gate /*
37c478bd9Sstevel@tonic-gate  *  GRUB  --  GRand Unified Bootloader
47c478bd9Sstevel@tonic-gate  *  Copyright (C) 2002  Free Software Foundation, Inc.
57c478bd9Sstevel@tonic-gate  *
67c478bd9Sstevel@tonic-gate  *  This program is free software; you can redistribute it and/or modify
77c478bd9Sstevel@tonic-gate  *  it under the terms of the GNU General Public License as published by
87c478bd9Sstevel@tonic-gate  *  the Free Software Foundation; either version 2 of the License, or
97c478bd9Sstevel@tonic-gate  *  (at your option) any later version.
107c478bd9Sstevel@tonic-gate  *
117c478bd9Sstevel@tonic-gate  *  This program is distributed in the hope that it will be useful,
127c478bd9Sstevel@tonic-gate  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
137c478bd9Sstevel@tonic-gate  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
147c478bd9Sstevel@tonic-gate  *  GNU General Public License for more details.
157c478bd9Sstevel@tonic-gate  *
167c478bd9Sstevel@tonic-gate  *  You should have received a copy of the GNU General Public License
177c478bd9Sstevel@tonic-gate  *  along with this program; if not, write to the Free Software
187c478bd9Sstevel@tonic-gate  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
197c478bd9Sstevel@tonic-gate  */
207c478bd9Sstevel@tonic-gate 
217c478bd9Sstevel@tonic-gate #include <shared.h>
227c478bd9Sstevel@tonic-gate #include <term.h>
237c478bd9Sstevel@tonic-gate 
247c478bd9Sstevel@tonic-gate /* These functions are defined in asm.S instead of this file:
257c478bd9Sstevel@tonic-gate    console_putchar, console_checkkey, console_getkey, console_getxy,
267c478bd9Sstevel@tonic-gate    console_gotoxy, console_cls, and console_nocursor.  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate int console_current_color = A_NORMAL;
297c478bd9Sstevel@tonic-gate static int console_standard_color = A_NORMAL;
307c478bd9Sstevel@tonic-gate static int console_normal_color = A_NORMAL;
317c478bd9Sstevel@tonic-gate static int console_highlight_color = A_REVERSE;
327c478bd9Sstevel@tonic-gate static color_state console_color_state = COLOR_STATE_STANDARD;
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate void
console_setcolorstate(color_state state)357c478bd9Sstevel@tonic-gate console_setcolorstate (color_state state)
367c478bd9Sstevel@tonic-gate {
377c478bd9Sstevel@tonic-gate   switch (state) {
387c478bd9Sstevel@tonic-gate     case COLOR_STATE_STANDARD:
397c478bd9Sstevel@tonic-gate       console_current_color = console_standard_color;
407c478bd9Sstevel@tonic-gate       break;
417c478bd9Sstevel@tonic-gate     case COLOR_STATE_NORMAL:
427c478bd9Sstevel@tonic-gate       console_current_color = console_normal_color;
437c478bd9Sstevel@tonic-gate       break;
447c478bd9Sstevel@tonic-gate     case COLOR_STATE_HIGHLIGHT:
457c478bd9Sstevel@tonic-gate       console_current_color = console_highlight_color;
467c478bd9Sstevel@tonic-gate       break;
477c478bd9Sstevel@tonic-gate     default:
487c478bd9Sstevel@tonic-gate       console_current_color = console_standard_color;
497c478bd9Sstevel@tonic-gate       break;
507c478bd9Sstevel@tonic-gate   }
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate   console_color_state = state;
537c478bd9Sstevel@tonic-gate }
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate void
console_setcolor(int normal_color,int highlight_color)567c478bd9Sstevel@tonic-gate console_setcolor (int normal_color, int highlight_color)
577c478bd9Sstevel@tonic-gate {
587c478bd9Sstevel@tonic-gate   console_normal_color = normal_color;
597c478bd9Sstevel@tonic-gate   console_highlight_color = highlight_color;
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate   console_setcolorstate (console_color_state);
627c478bd9Sstevel@tonic-gate }
63