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