]>
Commit | Line | Data |
---|---|---|
fb0b259e | 1 | /** @file\r |
8fd98315 | 2 | Implementation of translation upon PC ANSI.\r |
95276127 | 3 | \r |
8fd98315 | 4 | Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r |
fb0b259e | 5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
95276127 | 9 | \r |
fb0b259e | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
95276127 | 12 | \r |
fb0b259e | 13 | **/\r |
95276127 | 14 | \r |
15 | \r | |
95276127 | 16 | #include "Terminal.h"\r |
17 | \r | |
8fd98315 | 18 | /**\r |
11baadb6 | 19 | Translate all raw data in the Raw FIFO into unicode, and insert\r |
8fd98315 | 20 | them into Unicode FIFO.\r |
21 | \r | |
22 | @param TerminalDevice The terminal device.\r | |
23 | \r | |
8fd98315 | 24 | **/\r |
95276127 | 25 | VOID\r |
26 | AnsiRawDataToUnicode (\r | |
27 | IN TERMINAL_DEV *TerminalDevice\r | |
28 | )\r | |
29 | {\r | |
30 | UINT8 RawData;\r | |
31 | \r | |
32 | //\r | |
33 | // pop the raw data out from the raw fifo,\r | |
34 | // and translate it into unicode, then push\r | |
35 | // the unicode into unicode fifo, until the raw fifo is empty.\r | |
36 | //\r | |
37 | while (!IsRawFiFoEmpty (TerminalDevice)) {\r | |
38 | \r | |
39 | RawFiFoRemoveOneKey (TerminalDevice, &RawData);\r | |
40 | \r | |
41 | UnicodeFiFoInsertOneKey (TerminalDevice, (UINT16) RawData);\r | |
42 | }\r | |
43 | }\r | |
44 | \r | |
8fd98315 | 45 | /**\r |
46 | Check if input string is valid Ascii string, valid EFI control characters\r | |
47 | or valid text graphics.\r | |
48 | \r | |
49 | @param TerminalDevice The terminal device.\r | |
50 | @param WString The input string. \r | |
51 | \r | |
52 | @retval EFI_UNSUPPORTED If not all input characters are valid.\r | |
53 | @retval EFI_SUCCESS If all input characters are valid.\r | |
54 | \r | |
55 | **/\r | |
95276127 | 56 | EFI_STATUS\r |
57 | AnsiTestString (\r | |
58 | IN TERMINAL_DEV *TerminalDevice,\r | |
59 | IN CHAR16 *WString\r | |
60 | )\r | |
61 | {\r | |
62 | CHAR8 GraphicChar;\r | |
63 | \r | |
64 | //\r | |
65 | // support three kind of character:\r | |
66 | // valid ascii, valid efi control char, valid text graphics.\r | |
67 | //\r | |
68 | for (; *WString != CHAR_NULL; WString++) {\r | |
69 | \r | |
fb0b259e | 70 | if ( !(TerminalIsValidAscii (*WString) ||\r |
95276127 | 71 | TerminalIsValidEfiCntlChar (*WString) ||\r |
72 | TerminalIsValidTextGraphics (*WString, &GraphicChar, NULL) )) {\r | |
73 | \r | |
74 | return EFI_UNSUPPORTED;\r | |
75 | }\r | |
76 | }\r | |
77 | \r | |
78 | return EFI_SUCCESS;\r | |
79 | }\r |