]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/UnicodeCollationEng.c
Retiring the ANT/JAVA build and removing the older EDK II packages that required...
[mirror_edk2.git] / EdkModulePkg / Universal / Disk / UnicodeCollation / English / Dxe / UnicodeCollationEng.c
diff --git a/EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/UnicodeCollationEng.c b/EdkModulePkg/Universal/Disk/UnicodeCollation/English/Dxe/UnicodeCollationEng.c
deleted file mode 100644 (file)
index f043f37..0000000
+++ /dev/null
@@ -1,478 +0,0 @@
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation                                                         \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
-Module Name:\r
-  \r
-  UnicodeCollationEng.c\r
-\r
-Abstract:\r
-  \r
-  Unicode Collation Protocol (English)\r
-\r
-Revision History\r
-\r
---*/\r
-\r
-#include "UnicodeCollationEng.h"\r
-\r
-CHAR8 mEngUpperMap[0x100];\r
-CHAR8 mEngLowerMap[0x100];\r
-CHAR8 mEngInfoMap[0x100];\r
-\r
-CHAR8 mOtherChars[] = {\r
-  '0',\r
-  '1',\r
-  '2',\r
-  '3',\r
-  '4',\r
-  '5',\r
-  '6',\r
-  '7',\r
-  '8',\r
-  '9',\r
-  '\\',\r
-  '.',\r
-  '_',\r
-  '^',\r
-  '$',\r
-  '~',\r
-  '!',\r
-  '#',\r
-  '%',\r
-  '&',\r
-  '-',\r
-  '{',\r
-  '}',\r
-  '(',\r
-  ')',\r
-  '@',\r
-  '`',\r
-  '\'',\r
-  '\0'\r
-};\r
-\r
-EFI_HANDLE  mHandle = NULL;\r
-\r
-EFI_UNICODE_COLLATION_PROTOCOL  UnicodeEng = {\r
-  EngStriColl,\r
-  EngMetaiMatch,\r
-  EngStrLwr,\r
-  EngStrUpr,\r
-  EngFatToStr,\r
-  EngStrToFat,\r
-  "eng"\r
-};\r
-\r
-//\r
-//\r
-//\r
-EFI_STATUS\r
-InitializeUnicodeCollationEng (\r
-  IN EFI_HANDLE       ImageHandle,\r
-  IN EFI_SYSTEM_TABLE *SystemTable\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Initializes the Unicode Collation Driver\r
-\r
-Arguments:\r
-\r
-  ImageHandle -\r
-\r
-  SystemTable -\r
-  \r
-Returns:\r
-\r
-  EFI_SUCCESS\r
-  EFI_OUT_OF_RESOURCES\r
-\r
---*/\r
-{\r
-  UINTN       Index;\r
-  UINTN       Index2;\r
-\r
-  //\r
-  // Initialize mapping tables for the supported languages\r
-  //\r
-  for (Index = 0; Index < 0x100; Index++) {\r
-    mEngUpperMap[Index] = (CHAR8) Index;\r
-    mEngLowerMap[Index] = (CHAR8) Index;\r
-    mEngInfoMap[Index]  = 0;\r
-\r
-    if ((Index >= 'a' && Index <= 'z') || (Index >= 0xe0 && Index <= 0xf6) || (Index >= 0xf8 && Index <= 0xfe)) {\r
-\r
-      Index2                = Index - 0x20;\r
-      mEngUpperMap[Index]   = (CHAR8) Index2;\r
-      mEngLowerMap[Index2]  = (CHAR8) Index;\r
-\r
-      mEngInfoMap[Index] |= CHAR_FAT_VALID;\r
-      mEngInfoMap[Index2] |= CHAR_FAT_VALID;\r
-    }\r
-  }\r
-\r
-  for (Index = 0; mOtherChars[Index]; Index++) {\r
-    Index2 = mOtherChars[Index];\r
-    mEngInfoMap[Index2] |= CHAR_FAT_VALID;\r
-  }\r
-  //\r
-  // Create a handle for the device\r
-  //\r
-  return gBS->InstallProtocolInterface (\r
-                &mHandle,\r
-                &gEfiUnicodeCollationProtocolGuid,\r
-                EFI_NATIVE_INTERFACE,\r
-                &UnicodeEng\r
-                );\r
-}\r
-\r
-INTN\r
-EFIAPI\r
-EngStriColl (\r
-  IN EFI_UNICODE_COLLATION_PROTOCOL   *This,\r
-  IN CHAR16                           *s1,\r
-  IN CHAR16                           *s2\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Performs a case-insensitive comparison of two Null-terminated Unicode strings.\r
-  \r
-Arguments:\r
-\r
-  This\r
-  s1\r
-  s2\r
-  \r
-Returns:\r
-\r
---*/\r
-{\r
-  while (*s1) {\r
-    if (ToUpper (*s1) != ToUpper (*s2)) {\r
-      break;\r
-    }\r
-\r
-    s1 += 1;\r
-    s2 += 1;\r
-  }\r
-\r
-  return ToUpper (*s1) - ToUpper (*s2);\r
-}\r
-\r
-VOID\r
-EFIAPI\r
-EngStrLwr (\r
-  IN EFI_UNICODE_COLLATION_PROTOCOL   *This,\r
-  IN OUT CHAR16                       *Str\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Converts all the Unicode characters in a Null-terminated Unicode string\r
-  to lower case Unicode characters.\r
-\r
-Arguments:\r
-\r
-  This - A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.\r
-  Str1  - A pointer to a Null-terminated Unicode string.\r
-  Str2  - A pointer to a Null-terminated Unicode string.\r
-\r
-Returns:\r
-\r
-  0   - s1 is equivalent to s2.\r
-  > 0 - s1 is lexically greater than s2.\r
-  < 0 - s1 is lexically less than s2.\r
-\r
---*/\r
-{\r
-  while (*Str) {\r
-    *Str = ToLower (*Str);\r
-    Str += 1;\r
-  }\r
-}\r
-\r
-VOID\r
-EFIAPI\r
-EngStrUpr (\r
-  IN EFI_UNICODE_COLLATION_PROTOCOL   *This,\r
-  IN OUT CHAR16                       *Str\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Converts all the Unicode characters in a Null-terminated \r
-  Unicode string to upper case Unicode characters.\r
-\r
-Arguments:\r
-  This\r
-  Str\r
-\r
-Returns:\r
-  None\r
-  \r
---*/\r
-{\r
-  while (*Str) {\r
-    *Str = ToUpper (*Str);\r
-    Str += 1;\r
-  }\r
-}\r
-\r
-BOOLEAN\r
-EFIAPI\r
-EngMetaiMatch (\r
-  IN EFI_UNICODE_COLLATION_PROTOCOL   *This,\r
-  IN CHAR16                           *String,\r
-  IN CHAR16                           *Pattern\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Performs a case-insensitive comparison between a Null-terminated\r
-  Unicode pattern string and a Null-terminated Unicode string. \r
-\r
-  The pattern string can use the '?' wildcard to match any character, \r
-  and the '*' wildcard to match any sub-string.\r
-\r
-Arguments:\r
-\r
-  This     - A pointer to the EFI_UNICODE_COLLATION_PROTOCOL instance.\r
-  String   - A pointer to a Null-terminated Unicode string.\r
-  Pattern  - A pointer to a Null-terminated Unicode pattern string.\r
-\r
-Returns:\r
-\r
-  TRUE  - Pattern was found in String.\r
-  FALSE - Pattern was not found in String.\r
-\r
---*/\r
-{\r
-  CHAR16  CharC;\r
-  CHAR16  CharP;\r
-  CHAR16  Index3;\r
-\r
-  for (;;) {\r
-    CharP = *Pattern;\r
-    Pattern += 1;\r
-\r
-    switch (CharP) {\r
-    case 0:\r
-      //\r
-      // End of pattern.  If end of string, TRUE match\r
-      //\r
-      if (*String) {\r
-        return FALSE;\r
-      } else {\r
-        return TRUE;\r
-      }\r
-\r
-    case '*':\r
-      //\r
-      // Match zero or more chars\r
-      //\r
-      while (*String) {\r
-        if (EngMetaiMatch (This, String, Pattern)) {\r
-          return TRUE;\r
-        }\r
-\r
-        String += 1;\r
-      }\r
-\r
-      return EngMetaiMatch (This, String, Pattern);\r
-\r
-    case '?':\r
-      //\r
-      // Match any one char\r
-      //\r
-      if (!*String) {\r
-        return FALSE;\r
-      }\r
-\r
-      String += 1;\r
-      break;\r
-\r
-    case '[':\r
-      //\r
-      // Match char set\r
-      //\r
-      CharC = *String;\r
-      if (!CharC) {\r
-        //\r
-        // syntax problem\r
-        //\r
-        return FALSE;\r
-      }\r
-\r
-      Index3  = 0;\r
-      CharP   = *Pattern++;\r
-      while (CharP) {\r
-        if (CharP == ']') {\r
-          return FALSE;\r
-        }\r
-\r
-        if (CharP == '-') {\r
-          //\r
-          // if range of chars, get high range\r
-          //\r
-          CharP = *Pattern;\r
-          if (CharP == 0 || CharP == ']') {\r
-            //\r
-            // syntax problem\r
-            //\r
-            return FALSE;\r
-          }\r
-\r
-          if (ToUpper (CharC) >= ToUpper (Index3) && ToUpper (CharC) <= ToUpper (CharP)) {\r
-            //\r
-            // if in range, it's a match\r
-            //\r
-            break;\r
-          }\r
-        }\r
-\r
-        Index3 = CharP;\r
-        if (ToUpper (CharC) == ToUpper (CharP)) {\r
-          //\r
-          // if char matches\r
-          //\r
-          break;\r
-        }\r
-\r
-        CharP = *Pattern++;\r
-      }\r
-      //\r
-      // skip to end of match char set\r
-      //\r
-      while (CharP && CharP != ']') {\r
-        CharP = *Pattern;\r
-        Pattern += 1;\r
-      }\r
-\r
-      String += 1;\r
-      break;\r
-\r
-    default:\r
-      CharC = *String;\r
-      if (ToUpper (CharC) != ToUpper (CharP)) {\r
-        return FALSE;\r
-      }\r
-\r
-      String += 1;\r
-      break;\r
-    }\r
-  }\r
-}\r
-\r
-VOID\r
-EFIAPI\r
-EngFatToStr (\r
-  IN EFI_UNICODE_COLLATION_PROTOCOL   *This,\r
-  IN UINTN                            FatSize,\r
-  IN CHAR8                            *Fat,\r
-  OUT CHAR16                          *String\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Converts an 8.3 FAT file name using an OEM character set \r
-  to a Null-terminated Unicode string.\r
-\r
-  BUGBUG: Function has to expand DBCS FAT chars, currently not.\r
-\r
-Arguments:\r
-  This\r
-  FatSize\r
-  Fat\r
-  String\r
-  \r
-Returns:\r
-\r
---*/\r
-{\r
-  //\r
-  // No DBCS issues, just expand and add null terminate to end of string\r
-  //\r
-  while (*Fat && FatSize) {\r
-    *String = *Fat;\r
-    String += 1;\r
-    Fat += 1;\r
-    FatSize -= 1;\r
-  }\r
-\r
-  *String = 0;\r
-}\r
-\r
-BOOLEAN\r
-EFIAPI\r
-EngStrToFat (\r
-  IN EFI_UNICODE_COLLATION_PROTOCOL   *This,\r
-  IN CHAR16                           *String,\r
-  IN UINTN                            FatSize,\r
-  OUT CHAR8                           *Fat\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  Converts a Null-terminated Unicode string to legal characters \r
-  in a FAT filename using an OEM character set.\r
-\r
-  Functions has to crunch string to a fat string. Replacing\r
-  any chars that can't be represented in the fat name.\r
-\r
-Arguments:\r
-  This\r
-  String\r
-  FatSize\r
-  Fat\r
-\r
-Returns:\r
-  TRUE\r
-  FALSE\r
---*/\r
-{\r
-  BOOLEAN SpecialCharExist;\r
-\r
-  SpecialCharExist = FALSE;\r
-  while (*String && FatSize) {\r
-    //\r
-    // Skip '.' or ' ' when making a fat name\r
-    //\r
-    if (*String != '.' && *String != ' ') {\r
-      //\r
-      // If this is a valid fat char, move it.\r
-      // Otherwise, move a '_' and flag the fact that the name needs an Lfn\r
-      //\r
-      if (*String < 0x100 && (mEngInfoMap[*String] & CHAR_FAT_VALID)) {\r
-        *Fat = mEngUpperMap[*String];\r
-      } else {\r
-        *Fat              = '_';\r
-        SpecialCharExist  = TRUE;\r
-      }\r
-\r
-      Fat += 1;\r
-      FatSize -= 1;\r
-    }\r
-\r
-    String += 1;\r
-  }\r
-  //\r
-  // Do not terminate that fat string\r
-  //\r
-  return SpecialCharExist;\r
-}\r