]>
Commit | Line | Data |
---|---|---|
217697af | 1 | /** @file\r |
2 | \r | |
e43adbaf HW |
3 | Produces EFI_PRINT2_PROTOCOL and EFI_PRINT2S_PROTOCOL.\r |
4 | These protocols define basic print functions to print the format unicode and\r | |
5 | ascii string.\r | |
217697af | 6 | \r |
d1102dba | 7 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9d510e61 | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
217697af | 9 | \r |
10 | **/\r | |
11 | \r | |
12 | #ifndef __PPRINT2_H__\r | |
13 | #define __PPRINT2_H__\r | |
14 | \r | |
2b4d6ac8 | 15 | #define EFI_PRINT2_PROTOCOL_GUID \\r |
504dcb0a | 16 | { 0xf05976ef, 0x83f1, 0x4f3d, { 0x86, 0x19, 0xf7, 0x59, 0x5d, 0x41, 0xe5, 0x38 } }\r |
217697af | 17 | \r |
18 | //\r | |
19 | // Forward reference for pure ANSI compatability\r | |
20 | //\r | |
21 | typedef struct _EFI_PRINT2_PROTOCOL EFI_PRINT2_PROTOCOL;\r | |
22 | \r | |
23 | /**\r | |
0b6642e6 HW |
24 | Produces a Null-terminated Unicode string in an output buffer based on\r |
25 | a Null-terminated Unicode format string and a BASE_LIST argument list.\r | |
26 | \r | |
27 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
28 | and BufferSize.\r | |
29 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
30 | Arguments are pulled from the variable argument list specified by Marker based on the\r | |
31 | contents of the format string.\r | |
32 | The number of Unicode characters in the produced output buffer is returned not including\r | |
33 | the Null-terminator.\r | |
217697af | 34 | \r |
0b6642e6 HW |
35 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r |
36 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
37 | \r | |
38 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
39 | unmodified and 0 is returned.\r | |
40 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
41 | unmodified and 0 is returned.\r | |
42 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
43 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
44 | buffer is unmodified and 0 is returned.\r | |
45 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r | |
46 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
47 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
48 | \r | |
49 | If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.\r | |
50 | \r | |
51 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r | |
217697af | 52 | Unicode string.\r |
53 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
0b6642e6 | 54 | @param FormatString A Null-terminated Unicode format string.\r |
504dcb0a | 55 | @param Marker BASE_LIST marker for the variable argument list.\r |
0b6642e6 HW |
56 | \r |
57 | @return The number of Unicode characters in the produced output buffer not including the\r | |
217697af | 58 | Null-terminator.\r |
59 | \r | |
60 | **/\r | |
61 | typedef\r | |
62 | UINTN\r | |
0c1a4aa6 | 63 | (EFIAPI *UNICODE_BS_PRINT)(\r |
217697af | 64 | OUT CHAR16 *StartOfBuffer,\r |
65 | IN UINTN BufferSize,\r | |
66 | IN CONST CHAR16 *FormatString,\r | |
504dcb0a | 67 | IN BASE_LIST Marker\r |
217697af | 68 | );\r |
69 | \r | |
e996a8c9 | 70 | /**\r |
0b6642e6 | 71 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r |
e996a8c9 | 72 | Unicode format string and variable argument list.\r |
0b6642e6 HW |
73 | \r |
74 | This function is similar as snprintf_s defined in C11.\r | |
75 | \r | |
76 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
77 | and BufferSize.\r | |
e996a8c9 | 78 | The Unicode string is produced by parsing the format string specified by FormatString.\r |
79 | Arguments are pulled from the variable argument list based on the contents of the format string.\r | |
0b6642e6 HW |
80 | The number of Unicode characters in the produced output buffer is returned not including\r |
81 | the Null-terminator.\r | |
82 | \r | |
83 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
84 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
85 | \r | |
86 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
87 | unmodified and 0 is returned.\r | |
88 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
89 | unmodified and 0 is returned.\r | |
90 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
91 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
92 | buffer is unmodified and 0 is returned.\r | |
93 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r | |
94 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
95 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
e996a8c9 | 96 | \r |
0b6642e6 HW |
97 | If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.\r |
98 | \r | |
99 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r | |
e996a8c9 | 100 | Unicode string.\r |
101 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
0b6642e6 HW |
102 | @param FormatString A Null-terminated Unicode format string.\r |
103 | @param ... Variable argument list whose contents are accessed based on the\r | |
e996a8c9 | 104 | format string specified by FormatString.\r |
0b6642e6 | 105 | \r |
e996a8c9 | 106 | @return The number of Unicode characters in the produced output buffer not including the\r |
107 | Null-terminator.\r | |
108 | \r | |
109 | **/\r | |
110 | typedef\r | |
111 | UINTN\r | |
0c1a4aa6 | 112 | (EFIAPI *UNICODE_S_PRINT)(\r |
e996a8c9 | 113 | OUT CHAR16 *StartOfBuffer,\r |
114 | IN UINTN BufferSize,\r | |
115 | IN CONST CHAR16 *FormatString,\r | |
116 | ...\r | |
117 | );\r | |
118 | \r | |
217697af | 119 | /**\r |
0b6642e6 HW |
120 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r |
121 | ASCII format string and a BASE_LIST argument list.\r | |
122 | \r | |
123 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
124 | and BufferSize.\r | |
217697af | 125 | The Unicode string is produced by parsing the format string specified by FormatString.\r |
0b6642e6 | 126 | Arguments are pulled from the variable argument list specified by Marker based on the\r |
217697af | 127 | contents of the format string.\r |
0b6642e6 HW |
128 | The number of Unicode characters in the produced output buffer is returned not including\r |
129 | the Null-terminator.\r | |
130 | \r | |
131 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
217697af | 132 | \r |
0b6642e6 HW |
133 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r |
134 | unmodified and 0 is returned.\r | |
135 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
136 | unmodified and 0 is returned.\r | |
137 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
138 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
139 | buffer is unmodified and 0 is returned.\r | |
217697af | 140 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
0b6642e6 HW |
141 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
142 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
143 | \r | |
144 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r | |
217697af | 145 | \r |
0b6642e6 | 146 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
217697af | 147 | Unicode string.\r |
148 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
0b6642e6 | 149 | @param FormatString A Null-terminated ASCII format string.\r |
504dcb0a | 150 | @param Marker BASE_LIST marker for the variable argument list.\r |
0b6642e6 | 151 | \r |
217697af | 152 | @return The number of Unicode characters in the produced output buffer not including the\r |
153 | Null-terminator.\r | |
154 | \r | |
155 | **/\r | |
156 | typedef\r | |
157 | UINTN\r | |
0c1a4aa6 | 158 | (EFIAPI *UNICODE_BS_PRINT_ASCII_FORMAT)(\r |
217697af | 159 | OUT CHAR16 *StartOfBuffer,\r |
160 | IN UINTN BufferSize,\r | |
161 | IN CONST CHAR8 *FormatString,\r | |
504dcb0a | 162 | IN BASE_LIST Marker\r |
217697af | 163 | );\r |
164 | \r | |
e996a8c9 | 165 | /**\r |
0b6642e6 HW |
166 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r |
167 | ASCII format string and variable argument list.\r | |
168 | \r | |
169 | This function is similar as snprintf_s defined in C11.\r | |
170 | \r | |
171 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
172 | and BufferSize.\r | |
e996a8c9 | 173 | The Unicode string is produced by parsing the format string specified by FormatString.\r |
0b6642e6 HW |
174 | Arguments are pulled from the variable argument list based on the contents of the\r |
175 | format string.\r | |
176 | The number of Unicode characters in the produced output buffer is returned not including\r | |
177 | the Null-terminator.\r | |
e996a8c9 | 178 | \r |
0b6642e6 HW |
179 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r |
180 | \r | |
181 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
182 | unmodified and 0 is returned.\r | |
183 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
184 | unmodified and 0 is returned.\r | |
185 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
186 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
187 | buffer is unmodified and 0 is returned.\r | |
e996a8c9 | 188 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
0b6642e6 HW |
189 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
190 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
e996a8c9 | 191 | \r |
0b6642e6 HW |
192 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r |
193 | \r | |
194 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r | |
e996a8c9 | 195 | Unicode string.\r |
196 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
0b6642e6 HW |
197 | @param FormatString A Null-terminated ASCII format string.\r |
198 | @param ... Variable argument list whose contents are accessed based on the\r | |
e996a8c9 | 199 | format string specified by FormatString.\r |
0b6642e6 | 200 | \r |
e996a8c9 | 201 | @return The number of Unicode characters in the produced output buffer not including the\r |
202 | Null-terminator.\r | |
203 | \r | |
204 | **/\r | |
205 | typedef\r | |
206 | UINTN\r | |
0c1a4aa6 | 207 | (EFIAPI *UNICODE_S_PRINT_ASCII_FORMAT)(\r |
e996a8c9 | 208 | OUT CHAR16 *StartOfBuffer,\r |
209 | IN UINTN BufferSize,\r | |
210 | IN CONST CHAR8 *FormatString,\r | |
211 | ...\r | |
212 | );\r | |
213 | \r | |
217697af | 214 | /**\r |
215 | Converts a decimal value to a Null-terminated Unicode string.\r | |
d1102dba LG |
216 | \r |
217 | Converts the decimal number specified by Value to a Null-terminated Unicode\r | |
218 | string specified by Buffer containing at most Width characters. No padding of spaces\r | |
e9b67286 | 219 | is ever performed. If Width is 0, then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r |
220 | This function returns the number of Unicode characters in Buffer, not including\r | |
221 | the Null-terminator.\r | |
d1102dba | 222 | If the conversion contains more than Width characters, this function returns\r |
e9b67286 | 223 | the first Width characters in the conversion, along with the total number of characters in the conversion.\r |
d1102dba LG |
224 | Additional conversion parameters are specified in Flags.\r |
225 | \r | |
217697af | 226 | The Flags bit LEFT_JUSTIFY is always ignored.\r |
227 | All conversions are left justified in Buffer.\r | |
228 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
229 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r | |
230 | are inserted every 3rd digit starting from the right.\r | |
d1102dba | 231 | If RADIX_HEX is set in Flags, then the output buffer will be\r |
217697af | 232 | formatted in hexadecimal format.\r |
df8d0595 | 233 | If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.\r |
d1102dba LG |
234 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,\r |
235 | then Buffer is padded with '0' characters so the combination of the optional '-'\r | |
217697af | 236 | sign character, '0' characters, digit characters for Value, and the Null-terminator\r |
237 | add up to Width characters.\r | |
df8d0595 | 238 | If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r |
217697af | 239 | If Buffer is NULL, then ASSERT().\r |
240 | If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
241 | If unsupported bits are set in Flags, then ASSERT().\r | |
df8d0595 | 242 | If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r |
217697af | 243 | If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r |
244 | \r | |
64a80549 | 245 | @param Buffer The pointer to the output buffer for the produced Null-terminated\r |
217697af | 246 | Unicode string.\r |
247 | @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r | |
248 | @param Value The 64-bit signed value to convert to a string.\r | |
249 | @param Width The maximum number of Unicode characters to place in Buffer, not including\r | |
250 | the Null-terminator.\r | |
d1102dba | 251 | \r |
217697af | 252 | @return The number of Unicode characters in Buffer not including the Null-terminator.\r |
253 | \r | |
254 | **/\r | |
255 | typedef\r | |
256 | UINTN\r | |
0c1a4aa6 | 257 | (EFIAPI *UNICODE_VALUE_TO_STRING)(\r |
217697af | 258 | IN OUT CHAR16 *Buffer,\r |
259 | IN UINTN Flags,\r | |
260 | IN INT64 Value,\r | |
261 | IN UINTN Width\r | |
262 | );\r | |
263 | \r | |
264 | /**\r | |
265 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
504dcb0a | 266 | ASCII format string and a BASE_LIST argument list.\r |
0b6642e6 HW |
267 | \r |
268 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
269 | and BufferSize.\r | |
217697af | 270 | The ASCII string is produced by parsing the format string specified by FormatString.\r |
0b6642e6 | 271 | Arguments are pulled from the variable argument list specified by Marker based on\r |
217697af | 272 | the contents of the format string.\r |
0b6642e6 HW |
273 | The number of ASCII characters in the produced output buffer is returned not including\r |
274 | the Null-terminator.\r | |
217697af | 275 | \r |
0b6642e6 HW |
276 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r |
277 | unmodified and 0 is returned.\r | |
278 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
279 | unmodified and 0 is returned.\r | |
280 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
281 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
282 | is unmodified and 0 is returned.\r | |
217697af | 283 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
0b6642e6 HW |
284 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
285 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
286 | \r | |
287 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
217697af | 288 | \r |
0b6642e6 | 289 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
217697af | 290 | ASCII string.\r |
291 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
0b6642e6 | 292 | @param FormatString A Null-terminated ASCII format string.\r |
504dcb0a | 293 | @param Marker BASE_LIST marker for the variable argument list.\r |
0b6642e6 | 294 | \r |
217697af | 295 | @return The number of ASCII characters in the produced output buffer not including the\r |
296 | Null-terminator.\r | |
297 | \r | |
298 | **/\r | |
299 | typedef\r | |
300 | UINTN\r | |
0c1a4aa6 | 301 | (EFIAPI *ASCII_BS_PRINT)(\r |
217697af | 302 | OUT CHAR8 *StartOfBuffer,\r |
303 | IN UINTN BufferSize,\r | |
304 | IN CONST CHAR8 *FormatString,\r | |
504dcb0a | 305 | IN BASE_LIST Marker\r |
217697af | 306 | );\r |
307 | \r | |
e996a8c9 | 308 | /**\r |
309 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
0b6642e6 HW |
310 | ASCII format string and variable argument list.\r |
311 | \r | |
312 | This function is similar as snprintf_s defined in C11.\r | |
313 | \r | |
314 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
315 | and BufferSize.\r | |
e996a8c9 | 316 | The ASCII string is produced by parsing the format string specified by FormatString.\r |
0b6642e6 HW |
317 | Arguments are pulled from the variable argument list based on the contents of the\r |
318 | format string.\r | |
319 | The number of ASCII characters in the produced output buffer is returned not including\r | |
320 | the Null-terminator.\r | |
e996a8c9 | 321 | \r |
0b6642e6 HW |
322 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r |
323 | unmodified and 0 is returned.\r | |
324 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
325 | unmodified and 0 is returned.\r | |
326 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
327 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
328 | is unmodified and 0 is returned.\r | |
e996a8c9 | 329 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
0b6642e6 HW |
330 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
331 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
332 | \r | |
333 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
e996a8c9 | 334 | \r |
0b6642e6 | 335 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
e996a8c9 | 336 | ASCII string.\r |
337 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
0b6642e6 HW |
338 | @param FormatString A Null-terminated ASCII format string.\r |
339 | @param ... Variable argument list whose contents are accessed based on the\r | |
e996a8c9 | 340 | format string specified by FormatString.\r |
0b6642e6 | 341 | \r |
e996a8c9 | 342 | @return The number of ASCII characters in the produced output buffer not including the\r |
343 | Null-terminator.\r | |
344 | \r | |
345 | **/\r | |
346 | typedef\r | |
347 | UINTN\r | |
0c1a4aa6 | 348 | (EFIAPI *ASCII_S_PRINT)(\r |
e996a8c9 | 349 | OUT CHAR8 *StartOfBuffer,\r |
350 | IN UINTN BufferSize,\r | |
351 | IN CONST CHAR8 *FormatString,\r | |
352 | ...\r | |
353 | );\r | |
354 | \r | |
217697af | 355 | /**\r |
356 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
504dcb0a | 357 | Unicode format string and a BASE_LIST argument list.\r |
0b6642e6 HW |
358 | \r |
359 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
360 | and BufferSize.\r | |
217697af | 361 | The ASCII string is produced by parsing the format string specified by FormatString.\r |
0b6642e6 | 362 | Arguments are pulled from the variable argument list specified by Marker based on\r |
217697af | 363 | the contents of the format string.\r |
0b6642e6 HW |
364 | The number of ASCII characters in the produced output buffer is returned not including\r |
365 | the Null-terminator.\r | |
217697af | 366 | \r |
0b6642e6 HW |
367 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r |
368 | \r | |
369 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
370 | unmodified and 0 is returned.\r | |
371 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
372 | unmodified and 0 is returned.\r | |
373 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
374 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
375 | is unmodified and 0 is returned.\r | |
217697af | 376 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r |
0b6642e6 HW |
377 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r |
378 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
379 | \r | |
380 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
217697af | 381 | \r |
0b6642e6 | 382 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
217697af | 383 | ASCII string.\r |
384 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
0b6642e6 | 385 | @param FormatString A Null-terminated Unicode format string.\r |
504dcb0a | 386 | @param Marker BASE_LIST marker for the variable argument list.\r |
0b6642e6 | 387 | \r |
217697af | 388 | @return The number of ASCII characters in the produced output buffer not including the\r |
389 | Null-terminator.\r | |
390 | \r | |
391 | **/\r | |
392 | typedef\r | |
393 | UINTN\r | |
0c1a4aa6 | 394 | (EFIAPI *ASCII_BS_PRINT_UNICODE_FORMAT)(\r |
217697af | 395 | OUT CHAR8 *StartOfBuffer,\r |
396 | IN UINTN BufferSize,\r | |
397 | IN CONST CHAR16 *FormatString,\r | |
504dcb0a | 398 | IN BASE_LIST Marker\r |
217697af | 399 | );\r |
400 | \r | |
e996a8c9 | 401 | /**\r |
402 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
403 | Unicode format string and variable argument list.\r | |
0b6642e6 HW |
404 | \r |
405 | This function is similar as snprintf_s defined in C11.\r | |
406 | \r | |
407 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
408 | and BufferSize.\r | |
e996a8c9 | 409 | The ASCII string is produced by parsing the format string specified by FormatString.\r |
0b6642e6 HW |
410 | Arguments are pulled from the variable argument list based on the contents of the\r |
411 | format string.\r | |
412 | The number of ASCII characters in the produced output buffer is returned not including\r | |
413 | the Null-terminator.\r | |
414 | \r | |
415 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
e996a8c9 | 416 | \r |
0b6642e6 HW |
417 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r |
418 | unmodified and 0 is returned.\r | |
419 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
420 | unmodified and 0 is returned.\r | |
421 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
422 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
423 | is unmodified and 0 is returned.\r | |
424 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r | |
425 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
426 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
427 | \r | |
428 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
e996a8c9 | 429 | \r |
0b6642e6 | 430 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
e996a8c9 | 431 | ASCII string.\r |
432 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
0b6642e6 HW |
433 | @param FormatString A Null-terminated Unicode format string.\r |
434 | @param ... Variable argument list whose contents are accessed based on the\r | |
e996a8c9 | 435 | format string specified by FormatString.\r |
0b6642e6 | 436 | \r |
e996a8c9 | 437 | @return The number of ASCII characters in the produced output buffer not including the\r |
438 | Null-terminator.\r | |
439 | \r | |
440 | **/\r | |
441 | typedef\r | |
442 | UINTN\r | |
0c1a4aa6 | 443 | (EFIAPI *ASCII_S_PRINT_UNICODE_FORMAT)(\r |
e996a8c9 | 444 | OUT CHAR8 *StartOfBuffer,\r |
445 | IN UINTN BufferSize,\r | |
446 | IN CONST CHAR16 *FormatString,\r | |
447 | ...\r | |
448 | );\r | |
449 | \r | |
217697af | 450 | /**\r |
451 | Converts a decimal value to a Null-terminated ASCII string.\r | |
d1102dba LG |
452 | \r |
453 | Converts the decimal number specified by Value to a Null-terminated ASCII string\r | |
e40b7d5d | 454 | specified by Buffer containing at most Width characters. No padding of spaces is ever performed.\r |
e9b67286 | 455 | If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r |
217697af | 456 | The number of ASCII characters in Buffer is returned not including the Null-terminator.\r |
457 | If the conversion contains more than Width characters, then only the first Width\r | |
458 | characters are returned, and the total number of characters required to perform\r | |
459 | the conversion is returned.\r | |
d1102dba | 460 | Additional conversion parameters are specified in Flags.\r |
217697af | 461 | The Flags bit LEFT_JUSTIFY is always ignored.\r |
462 | All conversions are left justified in Buffer.\r | |
463 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
464 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r | |
465 | are inserted every 3rd digit starting from the right.\r | |
d1102dba | 466 | If RADIX_HEX is set in Flags, then the output buffer will be\r |
217697af | 467 | formatted in hexadecimal format.\r |
df8d0595 | 468 | If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.\r |
d1102dba LG |
469 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,\r |
470 | then Buffer is padded with '0' characters so the combination of the optional '-'\r | |
217697af | 471 | sign character, '0' characters, digit characters for Value, and the Null-terminator\r |
472 | add up to Width characters.\r | |
d1102dba | 473 | \r |
217697af | 474 | If Buffer is NULL, then ASSERT().\r |
475 | If unsupported bits are set in Flags, then ASSERT().\r | |
df8d0595 | 476 | If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r |
217697af | 477 | If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r |
478 | \r | |
64a80549 | 479 | @param Buffer The pointer to the output buffer for the produced Null-terminated\r |
217697af | 480 | ASCII string.\r |
481 | @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r | |
482 | @param Value The 64-bit signed value to convert to a string.\r | |
483 | @param Width The maximum number of ASCII characters to place in Buffer, not including\r | |
484 | the Null-terminator.\r | |
d1102dba | 485 | \r |
217697af | 486 | @return The number of ASCII characters in Buffer not including the Null-terminator.\r |
487 | \r | |
488 | **/\r | |
489 | typedef\r | |
490 | UINTN\r | |
0c1a4aa6 | 491 | (EFIAPI *ASCII_VALUE_TO_STRING)(\r |
e996a8c9 | 492 | OUT CHAR8 *Buffer,\r |
493 | IN UINTN Flags,\r | |
494 | IN INT64 Value,\r | |
495 | IN UINTN Width\r | |
217697af | 496 | );\r |
497 | \r | |
498 | struct _EFI_PRINT2_PROTOCOL {\r | |
504dcb0a | 499 | UNICODE_BS_PRINT UnicodeBSPrint;\r |
500 | UNICODE_S_PRINT UnicodeSPrint;\r | |
501 | UNICODE_BS_PRINT_ASCII_FORMAT UnicodeBSPrintAsciiFormat;\r | |
502 | UNICODE_S_PRINT_ASCII_FORMAT UnicodeSPrintAsciiFormat;\r | |
503 | UNICODE_VALUE_TO_STRING UnicodeValueToString;\r | |
504 | ASCII_BS_PRINT AsciiBSPrint;\r | |
505 | ASCII_S_PRINT AsciiSPrint;\r | |
506 | ASCII_BS_PRINT_UNICODE_FORMAT AsciiBSPrintUnicodeFormat;\r | |
507 | ASCII_S_PRINT_UNICODE_FORMAT AsciiSPrintUnicodeFormat;\r | |
508 | ASCII_VALUE_TO_STRING AsciiValueToString;\r | |
217697af | 509 | };\r |
510 | \r | |
511 | extern EFI_GUID gEfiPrint2ProtocolGuid;\r | |
512 | \r | |
e43adbaf HW |
513 | \r |
514 | #define EFI_PRINT2S_PROTOCOL_GUID \\r | |
515 | { 0xcc252d2, 0xc106, 0x4661, { 0xb5, 0xbd, 0x31, 0x47, 0xa4, 0xf8, 0x1f, 0x92 } }\r | |
516 | \r | |
517 | //\r | |
518 | // Forward reference for pure ANSI compatability\r | |
519 | //\r | |
520 | typedef struct _EFI_PRINT2S_PROTOCOL EFI_PRINT2S_PROTOCOL;\r | |
521 | \r | |
522 | /**\r | |
523 | Converts a decimal value to a Null-terminated Unicode string.\r | |
524 | \r | |
525 | Converts the decimal number specified by Value to a Null-terminated Unicode\r | |
526 | string specified by Buffer containing at most Width characters. No padding of\r | |
527 | spaces is ever performed. If Width is 0 then a width of\r | |
528 | MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than\r | |
529 | Width characters, then only the first Width characters are placed in Buffer.\r | |
530 | Additional conversion parameters are specified in Flags.\r | |
531 | \r | |
532 | The Flags bit LEFT_JUSTIFY is always ignored.\r | |
533 | All conversions are left justified in Buffer.\r | |
534 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
535 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and\r | |
536 | commas are inserted every 3rd digit starting from the right.\r | |
537 | If RADIX_HEX is set in Flags, then the output buffer will be formatted in\r | |
538 | hexadecimal format.\r | |
539 | If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in\r | |
540 | Buffer is a '-'.\r | |
541 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then\r | |
542 | Buffer is padded with '0' characters so the combination of the optional '-'\r | |
543 | sign character, '0' characters, digit characters for Value, and the\r | |
544 | Null-terminator add up to Width characters.\r | |
545 | \r | |
546 | If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
547 | If an error would be returned, then the function will also ASSERT().\r | |
548 | \r | |
549 | @param Buffer The pointer to the output buffer for the produced\r | |
550 | Null-terminated Unicode string.\r | |
551 | @param BufferSize The size of Buffer in bytes, including the\r | |
552 | Null-terminator.\r | |
553 | @param Flags The bitmask of flags that specify left justification,\r | |
554 | zero pad, and commas.\r | |
555 | @param Value The 64-bit signed value to convert to a string.\r | |
556 | @param Width The maximum number of Unicode characters to place in\r | |
557 | Buffer, not including the Null-terminator.\r | |
558 | \r | |
559 | @retval RETURN_SUCCESS The decimal value is converted.\r | |
560 | @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted\r | |
561 | value.\r | |
562 | @retval RETURN_INVALID_PARAMETER If Buffer is NULL.\r | |
563 | If PcdMaximumUnicodeStringLength is not\r | |
564 | zero, and BufferSize is greater than\r | |
565 | (PcdMaximumUnicodeStringLength *\r | |
566 | sizeof (CHAR16) + 1).\r | |
567 | If unsupported bits are set in Flags.\r | |
568 | If both COMMA_TYPE and RADIX_HEX are set in\r | |
569 | Flags.\r | |
570 | If Width >= MAXIMUM_VALUE_CHARACTERS.\r | |
571 | \r | |
572 | **/\r | |
573 | typedef\r | |
574 | RETURN_STATUS\r | |
575 | (EFIAPI *UNICODE_VALUE_TO_STRING_S)(\r | |
576 | IN OUT CHAR16 *Buffer,\r | |
577 | IN UINTN BufferSize,\r | |
578 | IN UINTN Flags,\r | |
579 | IN INT64 Value,\r | |
580 | IN UINTN Width\r | |
581 | );\r | |
582 | \r | |
583 | /**\r | |
584 | Converts a decimal value to a Null-terminated Ascii string.\r | |
585 | \r | |
586 | Converts the decimal number specified by Value to a Null-terminated Ascii\r | |
587 | string specified by Buffer containing at most Width characters. No padding of\r | |
588 | spaces is ever performed. If Width is 0 then a width of\r | |
589 | MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than\r | |
590 | Width characters, then only the first Width characters are placed in Buffer.\r | |
591 | Additional conversion parameters are specified in Flags.\r | |
592 | \r | |
593 | The Flags bit LEFT_JUSTIFY is always ignored.\r | |
594 | All conversions are left justified in Buffer.\r | |
595 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
596 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and\r | |
597 | commas are inserted every 3rd digit starting from the right.\r | |
598 | If RADIX_HEX is set in Flags, then the output buffer will be formatted in\r | |
599 | hexadecimal format.\r | |
600 | If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in\r | |
601 | Buffer is a '-'.\r | |
602 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then\r | |
603 | Buffer is padded with '0' characters so the combination of the optional '-'\r | |
604 | sign character, '0' characters, digit characters for Value, and the\r | |
605 | Null-terminator add up to Width characters.\r | |
606 | \r | |
e5735b98 | 607 | If an error would be returned, then the function will ASSERT().\r |
e43adbaf HW |
608 | \r |
609 | @param Buffer The pointer to the output buffer for the produced\r | |
610 | Null-terminated Ascii string.\r | |
611 | @param BufferSize The size of Buffer in bytes, including the\r | |
612 | Null-terminator.\r | |
613 | @param Flags The bitmask of flags that specify left justification,\r | |
614 | zero pad, and commas.\r | |
615 | @param Value The 64-bit signed value to convert to a string.\r | |
616 | @param Width The maximum number of Ascii characters to place in\r | |
617 | Buffer, not including the Null-terminator.\r | |
618 | \r | |
619 | @retval RETURN_SUCCESS The decimal value is converted.\r | |
620 | @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted\r | |
621 | value.\r | |
622 | @retval RETURN_INVALID_PARAMETER If Buffer is NULL.\r | |
623 | If PcdMaximumAsciiStringLength is not\r | |
624 | zero, and BufferSize is greater than\r | |
625 | PcdMaximumAsciiStringLength.\r | |
626 | If unsupported bits are set in Flags.\r | |
627 | If both COMMA_TYPE and RADIX_HEX are set in\r | |
628 | Flags.\r | |
629 | If Width >= MAXIMUM_VALUE_CHARACTERS.\r | |
630 | \r | |
631 | **/\r | |
632 | typedef\r | |
633 | RETURN_STATUS\r | |
634 | (EFIAPI *ASCII_VALUE_TO_STRING_S)(\r | |
635 | IN OUT CHAR8 *Buffer,\r | |
636 | IN UINTN BufferSize,\r | |
637 | IN UINTN Flags,\r | |
638 | IN INT64 Value,\r | |
639 | IN UINTN Width\r | |
640 | );\r | |
641 | \r | |
642 | struct _EFI_PRINT2S_PROTOCOL {\r | |
643 | UNICODE_BS_PRINT UnicodeBSPrint;\r | |
644 | UNICODE_S_PRINT UnicodeSPrint;\r | |
645 | UNICODE_BS_PRINT_ASCII_FORMAT UnicodeBSPrintAsciiFormat;\r | |
646 | UNICODE_S_PRINT_ASCII_FORMAT UnicodeSPrintAsciiFormat;\r | |
647 | UNICODE_VALUE_TO_STRING_S UnicodeValueToStringS;\r | |
648 | ASCII_BS_PRINT AsciiBSPrint;\r | |
649 | ASCII_S_PRINT AsciiSPrint;\r | |
650 | ASCII_BS_PRINT_UNICODE_FORMAT AsciiBSPrintUnicodeFormat;\r | |
651 | ASCII_S_PRINT_UNICODE_FORMAT AsciiSPrintUnicodeFormat;\r | |
652 | ASCII_VALUE_TO_STRING_S AsciiValueToStringS;\r | |
653 | };\r | |
654 | \r | |
655 | extern EFI_GUID gEfiPrint2SProtocolGuid;\r | |
656 | \r | |
217697af | 657 | #endif\r |