1 /** @file 2 Head file for Unicode Collation Protocol (English) 3 4 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 **/ 14 15 #ifndef _UNICODE_COLLATION_ENG_H_ 16 #define _UNICODE_COLLATION_ENG_H_ 17 18 19 20 #include <Uefi.h> 21 22 #include <Protocol/UnicodeCollation.h> 23 24 #include <Library/DebugLib.h> 25 #include <Library/UefiDriverEntryPoint.h> 26 #include <Library/UefiBootServicesTableLib.h> 27 #include <Library/PcdLib.h> 28 29 // 30 // Bit mask to indicate the validity of character in FAT file name. 31 // 32 #define CHAR_FAT_VALID 0x01 33 34 // 35 // Maximum FAT table size. 36 // 37 #define MAP_TABLE_SIZE 0x100 38 39 // 40 // Macro to map character a to upper case. 41 // 42 #define TO_UPPER(a) (CHAR16) ((a) <= 0xFF ? mEngUpperMap[a] : (a)) 43 44 // 45 // Macro to map character a to lower case. 46 // 47 #define TO_LOWER(a) (CHAR16) ((a) <= 0xFF ? mEngLowerMap[a] : (a)) 48 49 // 50 // Prototypes 51 // 52 /** 53 Performs a case-insensitive comparison of two Null-terminated strings. 54 55 @param This Protocol instance pointer. 56 @param Str1 A pointer to a Null-terminated string. 57 @param Str2 A pointer to a Null-terminated string. 58 59 @retval 0 Str1 is equivalent to Str2 60 @retval > 0 Str1 is lexically greater than Str2 61 @retval < 0 Str1 is lexically less than Str2 62 63 **/ 64 INTN 65 EFIAPI 66 EngStriColl ( 67 IN EFI_UNICODE_COLLATION_PROTOCOL *This, 68 IN CHAR16 *Str1, 69 IN CHAR16 *Str2 70 ); 71 72 /** 73 Performs a case-insensitive comparison of a Null-terminated 74 pattern string and a Null-terminated string. 75 76 @param This Protocol instance pointer. 77 @param String A pointer to a Null-terminated string. 78 @param Pattern A pointer to a Null-terminated pattern string. 79 80 @retval TRUE Pattern was found in String. 81 @retval FALSE Pattern was not found in String. 82 83 **/ 84 BOOLEAN 85 EFIAPI 86 EngMetaiMatch ( 87 IN EFI_UNICODE_COLLATION_PROTOCOL *This, 88 IN CHAR16 *String, 89 IN CHAR16 *Pattern 90 ); 91 92 /** 93 Converts all the characters in a Null-terminated string to 94 lower case characters. 95 96 @param This Protocol instance pointer. 97 @param Str A pointer to a Null-terminated string. 98 99 **/ 100 VOID 101 EFIAPI 102 EngStrLwr ( 103 IN EFI_UNICODE_COLLATION_PROTOCOL *This, 104 IN OUT CHAR16 *Str 105 ); 106 107 /** 108 Converts all the characters in a Null-terminated string to upper 109 case characters. 110 111 @param This Protocol instance pointer. 112 @param Str A pointer to a Null-terminated string. 113 114 **/ 115 VOID 116 EFIAPI 117 EngStrUpr ( 118 IN EFI_UNICODE_COLLATION_PROTOCOL *This, 119 IN OUT CHAR16 *Str 120 ); 121 122 /** 123 Converts an 8.3 FAT file name in an OEM character set to a Null-terminated string. 124 125 @param This Protocol instance pointer. 126 @param FatSize The size of the string Fat in bytes. 127 @param Fat A pointer to a Null-terminated string that contains an 8.3 file 128 name using an 8-bit OEM character set. 129 @param String A pointer to a Null-terminated string. The string must 130 be preallocated to hold FatSize characters. 131 132 **/ 133 VOID 134 EFIAPI 135 EngFatToStr ( 136 IN EFI_UNICODE_COLLATION_PROTOCOL *This, 137 IN UINTN FatSize, 138 IN CHAR8 *Fat, 139 OUT CHAR16 *String 140 ); 141 142 /** 143 Converts a Null-terminated string to legal characters in a FAT 144 filename using an OEM character set. 145 146 @param This Protocol instance pointer. 147 @param String A pointer to a Null-terminated string. The string must 148 be preallocated to hold FatSize characters. 149 @param FatSize The size of the string Fat in bytes. 150 @param Fat A pointer to a Null-terminated string that contains an 8.3 file 151 name using an OEM character set. 152 153 @retval TRUE Fat is a Long File Name 154 @retval FALSE Fat is an 8.3 file name 155 156 **/ 157 BOOLEAN 158 EFIAPI 159 EngStrToFat ( 160 IN EFI_UNICODE_COLLATION_PROTOCOL *This, 161 IN CHAR16 *String, 162 IN UINTN FatSize, 163 OUT CHAR8 *Fat 164 ); 165 166 /** 167 The user Entry Point for English module. 168 169 This function initializes unicode character mapping and then installs Unicode 170 Collation & Unicode Collation 2 Protocols based on the feature flags. 171 172 @param ImageHandle The firmware allocated handle for the EFI image. 173 @param SystemTable A pointer to the EFI System Table. 174 175 @retval EFI_SUCCESS The entry point is executed successfully. 176 @retval other Some error occurs when executing this entry point. 177 178 **/ 179 EFI_STATUS 180 EFIAPI 181 InitializeUnicodeCollationEng ( 182 IN EFI_HANDLE ImageHandle, 183 IN EFI_SYSTEM_TABLE *SystemTable 184 ); 185 186 #endif 187 188