• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*++
2 
3 Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution.  The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8 
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 Module Name:
13 
14   UnicodeCollation2.h
15 
16 Abstract:
17 
18   Unicode Collation2 protocol that follows the UEFI 2.0 specification.
19 
20 --*/
21 
22 #ifndef _UNICODE_COLLATION2_H_
23 #define _UNICODE_COLLATION2_H_
24 
25 #define EFI_UNICODE_COLLATION2_PROTOCOL_GUID \
26   { \
27     0xa4c751fc, 0x23ae, 0x4c3e, {0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49} \
28   }
29 
30 EFI_FORWARD_DECLARATION (EFI_UNICODE_COLLATION2_PROTOCOL);
31 
32 //
33 // Protocol data structures and defines
34 //
35 #define EFI_UNICODE_BYTE_ORDER_MARK          ((CHAR16)(0xfeff))
36 #define EFI_UNICODE_BYTE_ORDER_MARK_REVERSE  ((CHAR16)(0xfffe))
37 
38 //
39 // Protocol member functions
40 //
41 typedef
42 INTN
43 (EFIAPI *EFI_UNICODE_COLLATION2_STRICOLL) (
44   IN EFI_UNICODE_COLLATION2_PROTOCOL        * This,
45   IN CHAR16                                 *Str1,
46   IN CHAR16                                 *Str2
47   )
48 /*++
49 
50   Routine Description:
51     Performs a case-insensitive comparison of two Null-terminated Unicode
52     strings.
53 
54   Arguments:
55     This - Protocol instance pointer.
56     Str1 - A pointer to a Null-terminated Unicode string.
57     Str2 - A pointer to a Null-terminated Unicode string.
58 
59   Returns:
60     0   - Str1 is equivalent to Str2
61     > 0 - Str1 is lexically greater than Str2
62     < 0 - Str1 is lexically less than Str2
63 
64 --*/
65 ;
66 
67 typedef
68 BOOLEAN
69 (EFIAPI *EFI_UNICODE_COLLATION2_METAIMATCH) (
70   IN EFI_UNICODE_COLLATION2_PROTOCOL        * This,
71   IN CHAR16                                 *String,
72   IN CHAR16                                 *Pattern
73   )
74 /*++
75 
76   Routine Description:
77     Performs a case-insensitive comparison of a Null-terminated Unicode
78     pattern string and a Null-terminated Unicode string.
79 
80   Arguments:
81     This - Protocol instance pointer.
82     String  - A pointer to a Null-terminated Unicode string.
83     Pattern - A pointer to a Null-terminated Unicode pattern string.
84 
85   Returns:
86     TRUE -  Pattern was found in String.
87     FALSE - Pattern was not found in String.
88 
89 --*/
90 ;
91 
92 typedef
93 VOID
94 (EFIAPI *EFI_UNICODE_COLLATION2_STRLWR) (
95   IN EFI_UNICODE_COLLATION2_PROTOCOL        * This,
96   IN OUT CHAR16                             *Str
97   )
98 /*++
99 
100   Routine Description:
101     Converts all the Unicode characters in a Null-terminated Unicode string to
102     lower case Unicode characters.
103 
104   Arguments:
105     This - Protocol instance pointer.
106     String  - A pointer to a Null-terminated Unicode string.
107 
108   Returns:
109     NONE
110 
111 --*/
112 ;
113 
114 typedef
115 VOID
116 (EFIAPI *EFI_UNICODE_COLLATION2_STRUPR) (
117   IN EFI_UNICODE_COLLATION2_PROTOCOL        * This,
118   IN OUT CHAR16                             *Str
119   )
120 /*++
121 
122   Routine Description:
123    Converts all the Unicode characters in a Null-terminated Unicode string to upper
124    case Unicode characters.
125 
126   Arguments:
127     This   - Protocol instance pointer.
128     String - A pointer to a Null-terminated Unicode string.
129 
130   Returns:
131     NONE
132 
133 --*/
134 ;
135 
136 typedef
137 VOID
138 (EFIAPI *EFI_UNICODE_COLLATION2_FATTOSTR) (
139   IN EFI_UNICODE_COLLATION2_PROTOCOL        * This,
140   IN UINTN                                  FatSize,
141   IN CHAR8                                  *Fat,
142   OUT CHAR16                                *String
143   )
144 /*++
145 
146   Routine Description:
147    Converts an 8.3 FAT file name in an OEM character set to a Null-terminated
148    Unicode string.
149 
150   Arguments:
151     This    - Protocol instance pointer.
152     FatSize - The size of the string Fat in bytes.
153     Fat     - A pointer to a Null-terminated string that contains an 8.3 file
154                name using an OEM character set.
155     String  - A pointer to a Null-terminated Unicode string. The string must
156                be preallocated to hold FatSize Unicode characters.
157   Returns:
158     NONE
159 
160 --*/
161 ;
162 
163 typedef
164 BOOLEAN
165 (EFIAPI *EFI_UNICODE_COLLATION2_STRTOFAT) (
166   IN EFI_UNICODE_COLLATION2_PROTOCOL        * This,
167   IN CHAR16                                 *String,
168   IN UINTN                                  FatSize,
169   OUT CHAR8                                 *Fat
170   )
171 /*++
172 
173   Routine Description:
174     Converts a Null-terminated Unicode string to legal characters in a FAT
175     filename using an OEM character set.
176 
177   Arguments:
178     This    - Protocol instance pointer.
179     String  - A pointer to a Null-terminated Unicode string. The string must
180                be preallocated to hold FatSize Unicode characters.
181     FatSize - The size of the string Fat in bytes.
182     Fat     - A pointer to a Null-terminated string that contains an 8.3 file
183                name using an OEM character set.
184   Returns:
185     TRUE  - Fat is a Long File Name
186     FALSE - Fat is an 8.3 file name
187 
188 --*/
189 ;
190 
191 struct _EFI_UNICODE_COLLATION2_PROTOCOL {
192   //
193   // general
194   //
195   EFI_UNICODE_COLLATION2_STRICOLL    StriColl;
196   EFI_UNICODE_COLLATION2_METAIMATCH  MetaiMatch;
197   EFI_UNICODE_COLLATION2_STRLWR      StrLwr;
198   EFI_UNICODE_COLLATION2_STRUPR      StrUpr;
199 
200   //
201   // for supporting fat volumes
202   //
203   EFI_UNICODE_COLLATION2_FATTOSTR    FatToStr;
204   EFI_UNICODE_COLLATION2_STRTOFAT    StrToFat;
205 
206   CHAR8                             *SupportedLanguages;
207 };
208 
209 extern EFI_GUID gEfiUnicodeCollation2ProtocolGuid;
210 
211 #endif
212