1 |
/* |
/* |
2 |
* PUPA -- Preliminary Universal Programming Architecture for GRUB |
* PUPA -- Preliminary Universal Programming Architecture for GRUB |
3 |
* Copyright (C) 2002 Free Software Foundation, Inc. |
* Copyright (C) 2002 Free Software Foundation, Inc. |
4 |
* Copyright (C) 2002 Yoshinori K. Okuji <okuji@enbug.org> |
* Copyright (C) 2002,2003 Yoshinori K. Okuji <okuji@enbug.org> |
5 |
* |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
* 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 |
* it under the terms of the GNU General Public License as published by |
28 |
static pupa_uint8_t pupa_console_highlight_color = 0x70; |
static pupa_uint8_t pupa_console_highlight_color = 0x70; |
29 |
|
|
30 |
static void |
static void |
31 |
|
pupa_console_putchar (pupa_uint32_t c) |
32 |
|
{ |
33 |
|
if (c > 0x7f) |
34 |
|
{ |
35 |
|
/* Map some unicode characters to the VGA font, if possible. */ |
36 |
|
switch (c) |
37 |
|
{ |
38 |
|
case 0x2190: /* left arrow */ |
39 |
|
c = 0x1b; |
40 |
|
break; |
41 |
|
case 0x2191: /* up arrow */ |
42 |
|
c = 0x18; |
43 |
|
break; |
44 |
|
case 0x2192: /* right arrow */ |
45 |
|
c = 0x1a; |
46 |
|
break; |
47 |
|
case 0x2193: /* down arrow */ |
48 |
|
c = 0x19; |
49 |
|
break; |
50 |
|
case 0x2501: /* horizontal line */ |
51 |
|
c = 0xc4; |
52 |
|
break; |
53 |
|
case 0x2503: /* vertical line */ |
54 |
|
c = 0xb3; |
55 |
|
break; |
56 |
|
case 0x250F: /* upper-left corner */ |
57 |
|
c = 0xda; |
58 |
|
break; |
59 |
|
case 0x2513: /* upper-right corner */ |
60 |
|
c = 0xbf; |
61 |
|
break; |
62 |
|
case 0x2517: /* lower-left corner */ |
63 |
|
c = 0xc0; |
64 |
|
break; |
65 |
|
case 0x251B: /* lower-right corner */ |
66 |
|
c = 0xd9; |
67 |
|
break; |
68 |
|
|
69 |
|
default: |
70 |
|
c = '?'; |
71 |
|
break; |
72 |
|
} |
73 |
|
} |
74 |
|
|
75 |
|
pupa_console_real_putchar (c); |
76 |
|
} |
77 |
|
|
78 |
|
static void |
79 |
pupa_console_setcolorstate (pupa_term_color_state state) |
pupa_console_setcolorstate (pupa_term_color_state state) |
80 |
{ |
{ |
81 |
switch (state) { |
switch (state) { |
103 |
static struct pupa_term pupa_console_term = |
static struct pupa_term pupa_console_term = |
104 |
{ |
{ |
105 |
.name = "console", |
.name = "console", |
106 |
|
.init = 0, |
107 |
|
.fini = 0, |
108 |
.putchar = pupa_console_putchar, |
.putchar = pupa_console_putchar, |
109 |
.checkkey = pupa_console_checkkey, |
.checkkey = pupa_console_checkkey, |
110 |
.getkey = pupa_console_getkey, |
.getkey = pupa_console_getkey, |