]> git.proxmox.com Git - mirror_edk2.git/commitdiff
rename it.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 30 Jun 2008 08:59:07 +0000 (08:59 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 30 Jun 2008 08:59:07 +0000 (08:59 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5386 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Console/TerminalDxe/Vtutf8.c [new file with mode: 0644]
MdeModulePkg/Universal/Console/TerminalDxe/vtutf8.c [deleted file]

diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Vtutf8.c b/MdeModulePkg/Universal/Console/TerminalDxe/Vtutf8.c
new file mode 100644 (file)
index 0000000..286c937
--- /dev/null
@@ -0,0 +1,262 @@
+/**@file\r
+  Implementation translation among different code tyies.\r
+\r
+Copyright (c) 2006, Intel Corporation. <BR>\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "Terminal.h"\r
+\r
+VOID\r
+VTUTF8RawDataToUnicode (\r
+  IN  TERMINAL_DEV    *TerminalDevice\r
+  )\r
+{\r
+  UTF8_CHAR Utf8Char;\r
+  UINT8     ValidBytes;\r
+  UINT16    UnicodeChar;\r
+\r
+  ValidBytes = 0;\r
+  //\r
+  // pop the raw data out from the raw fifo,\r
+  // and translate it into unicode, then push\r
+  // the unicode into unicode fifo, until the raw fifo is empty.\r
+  //\r
+  while (!IsRawFiFoEmpty (TerminalDevice)) {\r
+\r
+    GetOneValidUtf8Char (TerminalDevice, &Utf8Char, &ValidBytes);\r
+\r
+    if (ValidBytes < 1 || ValidBytes > 3) {\r
+      continue;\r
+    }\r
+\r
+    Utf8ToUnicode (Utf8Char, ValidBytes, (CHAR16 *) &UnicodeChar);\r
+\r
+    UnicodeFiFoInsertOneKey (TerminalDevice, UnicodeChar);\r
+  }\r
+}\r
+\r
+VOID\r
+GetOneValidUtf8Char (\r
+  IN  TERMINAL_DEV      *Utf8Device,\r
+  OUT UTF8_CHAR         *Utf8Char,\r
+  OUT UINT8             *ValidBytes\r
+  )\r
+{\r
+  UINT8   Temp;\r
+  UINT8   Index;\r
+  BOOLEAN FetchFlag;\r
+\r
+  Temp      = 0;\r
+  Index     = 0;\r
+  FetchFlag = TRUE;\r
+\r
+  //\r
+  // if no valid Utf8 char is found in the RawFiFo,\r
+  // then *ValidBytes will be zero.\r
+  //\r
+  *ValidBytes = 0;\r
+\r
+  while (!IsRawFiFoEmpty (Utf8Device)) {\r
+\r
+    RawFiFoRemoveOneKey (Utf8Device, &Temp);\r
+\r
+    switch (*ValidBytes) {\r
+\r
+    case 0:\r
+      if ((Temp & 0x80) == 0) {\r
+        //\r
+        // one-byte utf8 char\r
+        //\r
+        *ValidBytes       = 1;\r
+\r
+        Utf8Char->Utf8_1  = Temp;\r
+\r
+        FetchFlag         = FALSE;\r
+\r
+      } else if ((Temp & 0xe0) == 0xc0) {\r
+        //\r
+        // two-byte utf8 char\r
+        //\r
+        *ValidBytes         = 2;\r
+\r
+        Utf8Char->Utf8_2[1] = Temp;\r
+\r
+      } else if ((Temp & 0xf0) == 0xe0) {\r
+        //\r
+        // three-byte utf8 char\r
+        //\r
+        *ValidBytes         = 3;\r
+\r
+        Utf8Char->Utf8_3[2] = Temp;\r
+\r
+        Index++;\r
+\r
+      } else {\r
+        //\r
+        // reset *ValidBytes to zero, let valid utf8 char search restart\r
+        //\r
+        *ValidBytes = 0;\r
+      }\r
+\r
+      break;\r
+\r
+    case 2:\r
+      if ((Temp & 0xc0) == 0x80) {\r
+\r
+        Utf8Char->Utf8_2[0] = Temp;\r
+\r
+        FetchFlag           = FALSE;\r
+\r
+      } else {\r
+\r
+        *ValidBytes = 0;\r
+      }\r
+      break;\r
+\r
+    case 3:\r
+      if ((Temp & 0xc0) == 0x80) {\r
+\r
+        Utf8Char->Utf8_3[2 - Index] = Temp;\r
+        Index++;\r
+        if (Index == 3) {\r
+          FetchFlag = FALSE;\r
+        }\r
+      } else {\r
+\r
+        *ValidBytes = 0;\r
+        Index       = 0;\r
+      }\r
+      break;\r
+\r
+    default:\r
+      break;\r
+    }\r
+\r
+    if (!FetchFlag) {\r
+      break;\r
+    }\r
+  }\r
+\r
+  return ;\r
+}\r
+\r
+VOID\r
+Utf8ToUnicode (\r
+  IN  UTF8_CHAR       Utf8Char,\r
+  IN  UINT8           ValidBytes,\r
+  OUT CHAR16          *UnicodeChar\r
+  )\r
+{\r
+  UINT8 UnicodeByte0;\r
+  UINT8 UnicodeByte1;\r
+  UINT8 Byte0;\r
+  UINT8 Byte1;\r
+  UINT8 Byte2;\r
+\r
+  *UnicodeChar = 0;\r
+\r
+  //\r
+  // translate utf8 code to unicode, in terminal standard,\r
+  // up to 3 bytes utf8 code is supported.\r
+  //\r
+  switch (ValidBytes) {\r
+  case 1:\r
+    //\r
+    // one-byte utf8 code\r
+    //\r
+    *UnicodeChar = (UINT16) Utf8Char.Utf8_1;\r
+    break;\r
+\r
+  case 2:\r
+    //\r
+    // two-byte utf8 code\r
+    //\r
+    Byte0         = Utf8Char.Utf8_2[0];\r
+    Byte1         = Utf8Char.Utf8_2[1];\r
+\r
+    UnicodeByte0  = (UINT8) ((Byte1 << 6) | (Byte0 & 0x3f));\r
+    UnicodeByte1  = (UINT8) ((Byte1 >> 2) & 0x07);\r
+    *UnicodeChar  = (UINT16) (UnicodeByte0 | (UnicodeByte1 << 8));\r
+    break;\r
+\r
+  case 3:\r
+    //\r
+    // three-byte utf8 code\r
+    //\r
+    Byte0         = Utf8Char.Utf8_3[0];\r
+    Byte1         = Utf8Char.Utf8_3[1];\r
+    Byte2         = Utf8Char.Utf8_3[2];\r
+\r
+    UnicodeByte0  = (UINT8) ((Byte1 << 6) | (Byte0 & 0x3f));\r
+    UnicodeByte1  = (UINT8) ((Byte2 << 4) | ((Byte1 >> 2) & 0x0f));\r
+    *UnicodeChar  = (UINT16) (UnicodeByte0 | (UnicodeByte1 << 8));\r
+\r
+  default:\r
+    break;\r
+  }\r
+\r
+  return ;\r
+}\r
+\r
+VOID\r
+UnicodeToUtf8 (\r
+  IN  CHAR16      Unicode,\r
+  OUT UTF8_CHAR   *Utf8Char,\r
+  OUT UINT8       *ValidBytes\r
+  )\r
+{\r
+  UINT8 UnicodeByte0;\r
+  UINT8 UnicodeByte1;\r
+  //\r
+  // translate unicode to utf8 code\r
+  //\r
+  UnicodeByte0  = (UINT8) Unicode;\r
+  UnicodeByte1  = (UINT8) (Unicode >> 8);\r
+\r
+  if (Unicode < 0x0080) {\r
+\r
+    Utf8Char->Utf8_1  = (UINT8) (UnicodeByte0 & 0x7f);\r
+    *ValidBytes       = 1;\r
+\r
+  } else if (Unicode < 0x0800) {\r
+    //\r
+    // byte sequence: high -> low\r
+    //                Utf8_2[0], Utf8_2[1]\r
+    //\r
+    Utf8Char->Utf8_2[1] = (UINT8) ((UnicodeByte0 & 0x3f) + 0x80);\r
+    Utf8Char->Utf8_2[0] = (UINT8) ((((UnicodeByte1 << 2) + (UnicodeByte0 >> 6)) & 0x1f) + 0xc0);\r
+\r
+    *ValidBytes         = 2;\r
+\r
+  } else {\r
+    //\r
+    // byte sequence: high -> low\r
+    //                Utf8_3[0], Utf8_3[1], Utf8_3[2]\r
+    //\r
+    Utf8Char->Utf8_3[2] = (UINT8) ((UnicodeByte0 & 0x3f) + 0x80);\r
+    Utf8Char->Utf8_3[1] = (UINT8) ((((UnicodeByte1 << 2) + (UnicodeByte0 >> 6)) & 0x3f) + 0x80);\r
+    Utf8Char->Utf8_3[0] = (UINT8) (((UnicodeByte1 >> 4) & 0x0f) + 0xe0);\r
+\r
+    *ValidBytes         = 3;\r
+  }\r
+}\r
+\r
+EFI_STATUS\r
+VTUTF8TestString (\r
+  IN  TERMINAL_DEV    *TerminalDevice,\r
+  IN  CHAR16          *WString\r
+  )\r
+{\r
+  //\r
+  // to utf8, all kind of characters are supported.\r
+  //\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/vtutf8.c b/MdeModulePkg/Universal/Console/TerminalDxe/vtutf8.c
deleted file mode 100644 (file)
index 286c937..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-/**@file\r
-  Implementation translation among different code tyies.\r
-\r
-Copyright (c) 2006, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "Terminal.h"\r
-\r
-VOID\r
-VTUTF8RawDataToUnicode (\r
-  IN  TERMINAL_DEV    *TerminalDevice\r
-  )\r
-{\r
-  UTF8_CHAR Utf8Char;\r
-  UINT8     ValidBytes;\r
-  UINT16    UnicodeChar;\r
-\r
-  ValidBytes = 0;\r
-  //\r
-  // pop the raw data out from the raw fifo,\r
-  // and translate it into unicode, then push\r
-  // the unicode into unicode fifo, until the raw fifo is empty.\r
-  //\r
-  while (!IsRawFiFoEmpty (TerminalDevice)) {\r
-\r
-    GetOneValidUtf8Char (TerminalDevice, &Utf8Char, &ValidBytes);\r
-\r
-    if (ValidBytes < 1 || ValidBytes > 3) {\r
-      continue;\r
-    }\r
-\r
-    Utf8ToUnicode (Utf8Char, ValidBytes, (CHAR16 *) &UnicodeChar);\r
-\r
-    UnicodeFiFoInsertOneKey (TerminalDevice, UnicodeChar);\r
-  }\r
-}\r
-\r
-VOID\r
-GetOneValidUtf8Char (\r
-  IN  TERMINAL_DEV      *Utf8Device,\r
-  OUT UTF8_CHAR         *Utf8Char,\r
-  OUT UINT8             *ValidBytes\r
-  )\r
-{\r
-  UINT8   Temp;\r
-  UINT8   Index;\r
-  BOOLEAN FetchFlag;\r
-\r
-  Temp      = 0;\r
-  Index     = 0;\r
-  FetchFlag = TRUE;\r
-\r
-  //\r
-  // if no valid Utf8 char is found in the RawFiFo,\r
-  // then *ValidBytes will be zero.\r
-  //\r
-  *ValidBytes = 0;\r
-\r
-  while (!IsRawFiFoEmpty (Utf8Device)) {\r
-\r
-    RawFiFoRemoveOneKey (Utf8Device, &Temp);\r
-\r
-    switch (*ValidBytes) {\r
-\r
-    case 0:\r
-      if ((Temp & 0x80) == 0) {\r
-        //\r
-        // one-byte utf8 char\r
-        //\r
-        *ValidBytes       = 1;\r
-\r
-        Utf8Char->Utf8_1  = Temp;\r
-\r
-        FetchFlag         = FALSE;\r
-\r
-      } else if ((Temp & 0xe0) == 0xc0) {\r
-        //\r
-        // two-byte utf8 char\r
-        //\r
-        *ValidBytes         = 2;\r
-\r
-        Utf8Char->Utf8_2[1] = Temp;\r
-\r
-      } else if ((Temp & 0xf0) == 0xe0) {\r
-        //\r
-        // three-byte utf8 char\r
-        //\r
-        *ValidBytes         = 3;\r
-\r
-        Utf8Char->Utf8_3[2] = Temp;\r
-\r
-        Index++;\r
-\r
-      } else {\r
-        //\r
-        // reset *ValidBytes to zero, let valid utf8 char search restart\r
-        //\r
-        *ValidBytes = 0;\r
-      }\r
-\r
-      break;\r
-\r
-    case 2:\r
-      if ((Temp & 0xc0) == 0x80) {\r
-\r
-        Utf8Char->Utf8_2[0] = Temp;\r
-\r
-        FetchFlag           = FALSE;\r
-\r
-      } else {\r
-\r
-        *ValidBytes = 0;\r
-      }\r
-      break;\r
-\r
-    case 3:\r
-      if ((Temp & 0xc0) == 0x80) {\r
-\r
-        Utf8Char->Utf8_3[2 - Index] = Temp;\r
-        Index++;\r
-        if (Index == 3) {\r
-          FetchFlag = FALSE;\r
-        }\r
-      } else {\r
-\r
-        *ValidBytes = 0;\r
-        Index       = 0;\r
-      }\r
-      break;\r
-\r
-    default:\r
-      break;\r
-    }\r
-\r
-    if (!FetchFlag) {\r
-      break;\r
-    }\r
-  }\r
-\r
-  return ;\r
-}\r
-\r
-VOID\r
-Utf8ToUnicode (\r
-  IN  UTF8_CHAR       Utf8Char,\r
-  IN  UINT8           ValidBytes,\r
-  OUT CHAR16          *UnicodeChar\r
-  )\r
-{\r
-  UINT8 UnicodeByte0;\r
-  UINT8 UnicodeByte1;\r
-  UINT8 Byte0;\r
-  UINT8 Byte1;\r
-  UINT8 Byte2;\r
-\r
-  *UnicodeChar = 0;\r
-\r
-  //\r
-  // translate utf8 code to unicode, in terminal standard,\r
-  // up to 3 bytes utf8 code is supported.\r
-  //\r
-  switch (ValidBytes) {\r
-  case 1:\r
-    //\r
-    // one-byte utf8 code\r
-    //\r
-    *UnicodeChar = (UINT16) Utf8Char.Utf8_1;\r
-    break;\r
-\r
-  case 2:\r
-    //\r
-    // two-byte utf8 code\r
-    //\r
-    Byte0         = Utf8Char.Utf8_2[0];\r
-    Byte1         = Utf8Char.Utf8_2[1];\r
-\r
-    UnicodeByte0  = (UINT8) ((Byte1 << 6) | (Byte0 & 0x3f));\r
-    UnicodeByte1  = (UINT8) ((Byte1 >> 2) & 0x07);\r
-    *UnicodeChar  = (UINT16) (UnicodeByte0 | (UnicodeByte1 << 8));\r
-    break;\r
-\r
-  case 3:\r
-    //\r
-    // three-byte utf8 code\r
-    //\r
-    Byte0         = Utf8Char.Utf8_3[0];\r
-    Byte1         = Utf8Char.Utf8_3[1];\r
-    Byte2         = Utf8Char.Utf8_3[2];\r
-\r
-    UnicodeByte0  = (UINT8) ((Byte1 << 6) | (Byte0 & 0x3f));\r
-    UnicodeByte1  = (UINT8) ((Byte2 << 4) | ((Byte1 >> 2) & 0x0f));\r
-    *UnicodeChar  = (UINT16) (UnicodeByte0 | (UnicodeByte1 << 8));\r
-\r
-  default:\r
-    break;\r
-  }\r
-\r
-  return ;\r
-}\r
-\r
-VOID\r
-UnicodeToUtf8 (\r
-  IN  CHAR16      Unicode,\r
-  OUT UTF8_CHAR   *Utf8Char,\r
-  OUT UINT8       *ValidBytes\r
-  )\r
-{\r
-  UINT8 UnicodeByte0;\r
-  UINT8 UnicodeByte1;\r
-  //\r
-  // translate unicode to utf8 code\r
-  //\r
-  UnicodeByte0  = (UINT8) Unicode;\r
-  UnicodeByte1  = (UINT8) (Unicode >> 8);\r
-\r
-  if (Unicode < 0x0080) {\r
-\r
-    Utf8Char->Utf8_1  = (UINT8) (UnicodeByte0 & 0x7f);\r
-    *ValidBytes       = 1;\r
-\r
-  } else if (Unicode < 0x0800) {\r
-    //\r
-    // byte sequence: high -> low\r
-    //                Utf8_2[0], Utf8_2[1]\r
-    //\r
-    Utf8Char->Utf8_2[1] = (UINT8) ((UnicodeByte0 & 0x3f) + 0x80);\r
-    Utf8Char->Utf8_2[0] = (UINT8) ((((UnicodeByte1 << 2) + (UnicodeByte0 >> 6)) & 0x1f) + 0xc0);\r
-\r
-    *ValidBytes         = 2;\r
-\r
-  } else {\r
-    //\r
-    // byte sequence: high -> low\r
-    //                Utf8_3[0], Utf8_3[1], Utf8_3[2]\r
-    //\r
-    Utf8Char->Utf8_3[2] = (UINT8) ((UnicodeByte0 & 0x3f) + 0x80);\r
-    Utf8Char->Utf8_3[1] = (UINT8) ((((UnicodeByte1 << 2) + (UnicodeByte0 >> 6)) & 0x3f) + 0x80);\r
-    Utf8Char->Utf8_3[0] = (UINT8) (((UnicodeByte1 >> 4) & 0x0f) + 0xe0);\r
-\r
-    *ValidBytes         = 3;\r
-  }\r
-}\r
-\r
-EFI_STATUS\r
-VTUTF8TestString (\r
-  IN  TERMINAL_DEV    *TerminalDevice,\r
-  IN  CHAR16          *WString\r
-  )\r
-{\r
-  //\r
-  // to utf8, all kind of characters are supported.\r
-  //\r
-  return EFI_SUCCESS;\r
-}\r