]>
Commit | Line | Data |
---|---|---|
4bc6ad39 RN |
1 | /** @file\r |
2 | Implementation of translation upon PC ANSI.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r | |
5 | 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 | |
9 | \r | |
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 | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | \r | |
16 | #include "Terminal.h"\r | |
17 | \r | |
18 | /**\r | |
19 | Translate all raw data in the Raw FIFO into unicode, and insert\r | |
20 | them into Unicode FIFO.\r | |
21 | \r | |
22 | @param TerminalDevice The terminal device.\r | |
23 | \r | |
24 | **/\r | |
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) && !IsUnicodeFiFoFull (TerminalDevice)) {\r | |
38 | \r | |
39 | RawFiFoRemoveOneKey (TerminalDevice, &RawData);\r | |
40 | \r | |
41 | UnicodeFiFoInsertOneKey (TerminalDevice, (UINT16) RawData);\r | |
42 | }\r | |
43 | }\r | |
44 | \r | |
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 | |
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 | |
70 | if ( !(TerminalIsValidAscii (*WString) ||\r | |
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 |