3 This print protocol defines six basic print functions to
4 print the format unicode and ascii string.
6 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials are licensed and made available under
8 the terms and conditions of the BSD License that accompanies this distribution.
9 The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php.
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #define EFI_PRINT2_PROTOCOL_GUID \
21 { 0xf05976ef, 0x83f1, 0x4f3d, { 0x86, 0x19, 0xf7, 0x59, 0x5d, 0x41, 0xe5, 0x38 } }
24 // Forward reference for pure ANSI compatability
26 typedef struct _EFI_PRINT2_PROTOCOL EFI_PRINT2_PROTOCOL
;
29 Produces a Null-terminated Unicode string in an output buffer based on
30 a Null-terminated Unicode format string and a BASE_LIST argument list.
32 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
34 The Unicode string is produced by parsing the format string specified by FormatString.
35 Arguments are pulled from the variable argument list specified by Marker based on the
36 contents of the format string.
37 The number of Unicode characters in the produced output buffer is returned not including
40 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
41 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
43 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
44 unmodified and 0 is returned.
45 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
46 unmodified and 0 is returned.
47 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
48 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
49 buffer is unmodified and 0 is returned.
50 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
51 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
52 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
54 If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
56 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
58 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
59 @param FormatString A Null-terminated Unicode format string.
60 @param Marker BASE_LIST marker for the variable argument list.
62 @return The number of Unicode characters in the produced output buffer not including the
68 (EFIAPI
*UNICODE_BS_PRINT
)(
69 OUT CHAR16
*StartOfBuffer
,
71 IN CONST CHAR16
*FormatString
,
76 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
77 Unicode format string and variable argument list.
79 This function is similar as snprintf_s defined in C11.
81 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
83 The Unicode string is produced by parsing the format string specified by FormatString.
84 Arguments are pulled from the variable argument list based on the contents of the format string.
85 The number of Unicode characters in the produced output buffer is returned not including
88 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
89 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
91 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
92 unmodified and 0 is returned.
93 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
94 unmodified and 0 is returned.
95 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
96 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
97 buffer is unmodified and 0 is returned.
98 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
99 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
100 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
102 If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
104 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
106 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
107 @param FormatString A Null-terminated Unicode format string.
108 @param ... Variable argument list whose contents are accessed based on the
109 format string specified by FormatString.
111 @return The number of Unicode characters in the produced output buffer not including the
117 (EFIAPI
*UNICODE_S_PRINT
)(
118 OUT CHAR16
*StartOfBuffer
,
120 IN CONST CHAR16
*FormatString
,
125 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
126 ASCII format string and a BASE_LIST argument list.
128 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
130 The Unicode string is produced by parsing the format string specified by FormatString.
131 Arguments are pulled from the variable argument list specified by Marker based on the
132 contents of the format string.
133 The number of Unicode characters in the produced output buffer is returned not including
136 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
138 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
139 unmodified and 0 is returned.
140 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
141 unmodified and 0 is returned.
142 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
143 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
144 buffer is unmodified and 0 is returned.
145 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
146 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
147 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
149 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
151 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
153 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
154 @param FormatString A Null-terminated ASCII format string.
155 @param Marker BASE_LIST marker for the variable argument list.
157 @return The number of Unicode characters in the produced output buffer not including the
163 (EFIAPI
*UNICODE_BS_PRINT_ASCII_FORMAT
)(
164 OUT CHAR16
*StartOfBuffer
,
166 IN CONST CHAR8
*FormatString
,
171 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
172 ASCII format string and variable argument list.
174 This function is similar as snprintf_s defined in C11.
176 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
178 The Unicode string is produced by parsing the format string specified by FormatString.
179 Arguments are pulled from the variable argument list based on the contents of the
181 The number of Unicode characters in the produced output buffer is returned not including
184 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
186 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
187 unmodified and 0 is returned.
188 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
189 unmodified and 0 is returned.
190 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
191 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
192 buffer is unmodified and 0 is returned.
193 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
194 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
195 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
197 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
199 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
201 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
202 @param FormatString A Null-terminated ASCII format string.
203 @param ... Variable argument list whose contents are accessed based on the
204 format string specified by FormatString.
206 @return The number of Unicode characters in the produced output buffer not including the
212 (EFIAPI
*UNICODE_S_PRINT_ASCII_FORMAT
)(
213 OUT CHAR16
*StartOfBuffer
,
215 IN CONST CHAR8
*FormatString
,
220 Converts a decimal value to a Null-terminated Unicode string.
222 Converts the decimal number specified by Value to a Null-terminated Unicode
223 string specified by Buffer containing at most Width characters. No padding of spaces
224 is ever performed. If Width is 0, then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
225 This function returns the number of Unicode characters in Buffer, not including
227 If the conversion contains more than Width characters, this function returns
228 the first Width characters in the conversion, along with the total number of characters in the conversion.
229 Additional conversion parameters are specified in Flags.
231 The Flags bit LEFT_JUSTIFY is always ignored.
232 All conversions are left justified in Buffer.
233 If Width is 0, PREFIX_ZERO is ignored in Flags.
234 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
235 are inserted every 3rd digit starting from the right.
236 If RADIX_HEX is set in Flags, then the output buffer will be
237 formatted in hexadecimal format.
238 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
239 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
240 then Buffer is padded with '0' characters so the combination of the optional '-'
241 sign character, '0' characters, digit characters for Value, and the Null-terminator
242 add up to Width characters.
243 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
244 If Buffer is NULL, then ASSERT().
245 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
246 If unsupported bits are set in Flags, then ASSERT().
247 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
248 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
250 @param Buffer The pointer to the output buffer for the produced Null-terminated
252 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
253 @param Value The 64-bit signed value to convert to a string.
254 @param Width The maximum number of Unicode characters to place in Buffer, not including
257 @return The number of Unicode characters in Buffer not including the Null-terminator.
262 (EFIAPI
*UNICODE_VALUE_TO_STRING
)(
263 IN OUT CHAR16
*Buffer
,
270 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
271 ASCII format string and a BASE_LIST argument list.
273 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
275 The ASCII string is produced by parsing the format string specified by FormatString.
276 Arguments are pulled from the variable argument list specified by Marker based on
277 the contents of the format string.
278 The number of ASCII characters in the produced output buffer is returned not including
281 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
282 unmodified and 0 is returned.
283 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
284 unmodified and 0 is returned.
285 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
286 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
287 is unmodified and 0 is returned.
288 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
289 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
290 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
292 If BufferSize is 0, then no output buffer is produced and 0 is returned.
294 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
296 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
297 @param FormatString A Null-terminated ASCII format string.
298 @param Marker BASE_LIST marker for the variable argument list.
300 @return The number of ASCII characters in the produced output buffer not including the
306 (EFIAPI
*ASCII_BS_PRINT
)(
307 OUT CHAR8
*StartOfBuffer
,
309 IN CONST CHAR8
*FormatString
,
314 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
315 ASCII format string and variable argument list.
317 This function is similar as snprintf_s defined in C11.
319 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
321 The ASCII string is produced by parsing the format string specified by FormatString.
322 Arguments are pulled from the variable argument list based on the contents of the
324 The number of ASCII characters in the produced output buffer is returned not including
327 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
328 unmodified and 0 is returned.
329 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
330 unmodified and 0 is returned.
331 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
332 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
333 is unmodified and 0 is returned.
334 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
335 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
336 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
338 If BufferSize is 0, then no output buffer is produced and 0 is returned.
340 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
342 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
343 @param FormatString A Null-terminated ASCII format string.
344 @param ... Variable argument list whose contents are accessed based on the
345 format string specified by FormatString.
347 @return The number of ASCII characters in the produced output buffer not including the
353 (EFIAPI
*ASCII_S_PRINT
)(
354 OUT CHAR8
*StartOfBuffer
,
356 IN CONST CHAR8
*FormatString
,
361 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
362 Unicode format string and a BASE_LIST argument list.
364 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
366 The ASCII string is produced by parsing the format string specified by FormatString.
367 Arguments are pulled from the variable argument list specified by Marker based on
368 the contents of the format string.
369 The number of ASCII characters in the produced output buffer is returned not including
372 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
374 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
375 unmodified and 0 is returned.
376 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
377 unmodified and 0 is returned.
378 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
379 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
380 is unmodified and 0 is returned.
381 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
382 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
383 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
385 If BufferSize is 0, then no output buffer is produced and 0 is returned.
387 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
389 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
390 @param FormatString A Null-terminated Unicode format string.
391 @param Marker BASE_LIST marker for the variable argument list.
393 @return The number of ASCII characters in the produced output buffer not including the
399 (EFIAPI
*ASCII_BS_PRINT_UNICODE_FORMAT
)(
400 OUT CHAR8
*StartOfBuffer
,
402 IN CONST CHAR16
*FormatString
,
407 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
408 Unicode format string and variable argument list.
410 This function is similar as snprintf_s defined in C11.
412 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
414 The ASCII string is produced by parsing the format string specified by FormatString.
415 Arguments are pulled from the variable argument list based on the contents of the
417 The number of ASCII characters in the produced output buffer is returned not including
420 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
422 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
423 unmodified and 0 is returned.
424 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
425 unmodified and 0 is returned.
426 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
427 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
428 is unmodified and 0 is returned.
429 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
430 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
431 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
433 If BufferSize is 0, then no output buffer is produced and 0 is returned.
435 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
437 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
438 @param FormatString A Null-terminated Unicode format string.
439 @param ... Variable argument list whose contents are accessed based on the
440 format string specified by FormatString.
442 @return The number of ASCII characters in the produced output buffer not including the
448 (EFIAPI
*ASCII_S_PRINT_UNICODE_FORMAT
)(
449 OUT CHAR8
*StartOfBuffer
,
451 IN CONST CHAR16
*FormatString
,
456 Converts a decimal value to a Null-terminated ASCII string.
458 Converts the decimal number specified by Value to a Null-terminated ASCII string
459 specified by Buffer containing at most Width characters. No padding of spaces is ever performed.
460 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
461 The number of ASCII characters in Buffer is returned not including the Null-terminator.
462 If the conversion contains more than Width characters, then only the first Width
463 characters are returned, and the total number of characters required to perform
464 the conversion is returned.
465 Additional conversion parameters are specified in Flags.
466 The Flags bit LEFT_JUSTIFY is always ignored.
467 All conversions are left justified in Buffer.
468 If Width is 0, PREFIX_ZERO is ignored in Flags.
469 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
470 are inserted every 3rd digit starting from the right.
471 If RADIX_HEX is set in Flags, then the output buffer will be
472 formatted in hexadecimal format.
473 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
474 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
475 then Buffer is padded with '0' characters so the combination of the optional '-'
476 sign character, '0' characters, digit characters for Value, and the Null-terminator
477 add up to Width characters.
479 If Buffer is NULL, then ASSERT().
480 If unsupported bits are set in Flags, then ASSERT().
481 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
482 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
484 @param Buffer The pointer to the output buffer for the produced Null-terminated
486 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
487 @param Value The 64-bit signed value to convert to a string.
488 @param Width The maximum number of ASCII characters to place in Buffer, not including
491 @return The number of ASCII characters in Buffer not including the Null-terminator.
496 (EFIAPI
*ASCII_VALUE_TO_STRING
)(
503 struct _EFI_PRINT2_PROTOCOL
{
504 UNICODE_BS_PRINT UnicodeBSPrint
;
505 UNICODE_S_PRINT UnicodeSPrint
;
506 UNICODE_BS_PRINT_ASCII_FORMAT UnicodeBSPrintAsciiFormat
;
507 UNICODE_S_PRINT_ASCII_FORMAT UnicodeSPrintAsciiFormat
;
508 UNICODE_VALUE_TO_STRING UnicodeValueToString
;
509 ASCII_BS_PRINT AsciiBSPrint
;
510 ASCII_S_PRINT AsciiSPrint
;
511 ASCII_BS_PRINT_UNICODE_FORMAT AsciiBSPrintUnicodeFormat
;
512 ASCII_S_PRINT_UNICODE_FORMAT AsciiSPrintUnicodeFormat
;
513 ASCII_VALUE_TO_STRING AsciiValueToString
;
516 extern EFI_GUID gEfiPrint2ProtocolGuid
;