]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/PrintLib.h
2 Provides services to print a formatted string to a buffer. All combinations of
3 Unicode and ASCII strings are supported.
5 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
8 The Print Library functions provide a simple means to produce formatted output
9 strings. Many of the output functions use a format string to describe how to
10 format the output of variable arguments. The format string consists of normal
11 text and argument descriptors. There are no restrictions for how the normal
12 text and argument descriptors can be mixed. The following end of line(EOL)
13 translations must be performed on the contents of the format string:
15 - '\\r' is translated to '\\r'
16 - '\\r\\n' is translated to '\\r\\n'
17 - '\\n' is translated to '\\r\\n'
18 - '\\n\\r' is translated to '\\r\\n'
20 This does not follow the ANSI C standard for sprint(). The format of argument
21 descriptors is described below. The ANSI C standard for sprint() has been
22 followed for some of the format types, and has not been followed for others.
23 The exceptions are noted below.
25 %[flags][width][.precision]type
29 - The field is left justified. If not flag is not specified, then the
30 field is right justified.
32 - Prefix a space character to a number. Only valid for types X, x, and d.
34 - Prefix a plus character to a number. Only valid for types X, x, and d.
35 If both space and + are specified, then space is ignored.
37 - Pad with 0 characters to the left of a number. Only valid for types
40 - Place a comma every 3rd digit of the number. Only valid for type d.
41 If 0 is also specified, then 0 is ignored.
43 - The number being printed is size UINT64. Only valid for types X, x, and d.
44 If this flag is not specified, then the number being printed is size int.
45 - NOTE: All invalid flags are ignored.
50 - The width of the field is specified by a UINTN argument in the
53 - The number specified as a decimal value represents the width of
55 - NOTE: If [width] is not specified, then a field width of 0 is assumed.
60 - The precision of the field is specified by a UINTN argument in the
63 - The number specified as a decimal value represents the precision of
65 - NOTE: If [.precision] is not specified, then a precision of 0 is assumed.
72 - The argument is a Unicode character. ASCII characters can be printed
73 using this type too by making sure bits 8..15 of the argument are set to 0.
75 - The argument is an unsigned hexadecimal number. The characters used are 0..9 and
76 A..F. If the flag 'L' is not specified, then the argument is assumed
77 to be size int. This does not follow ANSI C.
79 - The argument is an unsigned hexadecimal number and the number is padded with
80 zeros. This is equivalent to a format string of "0x". If the flag
81 'L' is not specified, then the argument is assumed to be size int.
82 This does not follow ANSI C.
84 - The argument is a signed decimal number. If the flag 'L' is not specified,
85 then the argument is assumed to be size int.
87 - The argument is a unsigned decimal number. If the flag 'L' is not specified,
88 then the argument is assumed to be size int.
90 - The argument is a pointer that is a (VOID *), and it is printed as an
91 unsigned hexadecimal number The characters used are 0..9 and A..F.
93 - The argument is a pointer to an ASCII string.
94 This does not follow ANSI C.
96 - The argument is a pointer to a Unicode string.
97 This does not follow ANSI C.
99 - The argument is a pointer to a GUID structure. The GUID is printed
100 in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
101 This does not follow ANSI C.
103 - The argument is a pointer to an EFI_TIME structure. The time and
104 date are printed in the format "mm/dd/yyyy hh:mm" where mm is the
105 month zero padded, dd is the day zero padded, yyyy is the year zero
106 padded, hh is the hour zero padded, and mm is minutes zero padded.
107 This does not follow ANSI C.
109 - The argument is a RETURN_STATUS value. This value is converted to
110 a string following the table below. This does not follow ANSI C.
115 - RETURN_INVALID_PARAMETER
116 - "Invalid Parameter"
119 - RETURN_BAD_BUFFER_SIZE
121 - RETURN_BUFFER_TOO_SMALL
125 - RETURN_DEVICE_ERROR
127 - RETURN_WRITE_PROTECTED
129 - RETURN_OUT_OF_RESOURCES
131 - RETURN_VOLUME_CORRUPTED
137 - RETURN_MEDIA_CHANGED
141 - RETURN_ACCESS_DENIED
151 - RETURN_ALREADY_STARTED
159 - RETURN_PROTOCOL_ERROR
161 - RETURN_WARN_UNKNOWN_GLYPH
162 - "Warning Unknown Glyph"
163 - RETURN_WARN_DELETE_FAILURE
164 - "Warning Delete Failure"
165 - RETURN_WARN_WRITE_FAILURE
166 - "Warning Write Failure"
167 - RETURN_WARN_BUFFER_TOO_SMALL
168 - "Warning Buffer Too Small"
172 #ifndef __PRINT_LIB_H__
173 #define __PRINT_LIB_H__
176 /// Define the maximum number of characters that are required to
177 /// encode with a NULL terminator a decimal, hexadecimal, GUID,
180 /// Maximum Length Decimal String = 28
181 /// "-9,223,372,036,854,775,808"
182 /// Maximum Length Hexadecimal String = 17
183 /// "FFFFFFFFFFFFFFFF"
184 /// Maximum Length GUID = 37
185 /// "00000000-0000-0000-0000-000000000000"
186 /// Maximum Length TIME = 18
187 /// "12/12/2006 12:12"
189 #define MAXIMUM_VALUE_CHARACTERS 38
192 /// Flags bitmask values use in UnicodeValueToString() and
193 /// AsciiValueToString()
195 #define LEFT_JUSTIFY 0x01
196 #define COMMA_TYPE 0x08
197 #define PREFIX_ZERO 0x20
198 #define RADIX_HEX 0x80
201 Produces a Null-terminated Unicode string in an output buffer based on
202 a Null-terminated Unicode format string and a VA_LIST argument list.
204 This function is similar as vsnprintf_s defined in C11.
206 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
208 The Unicode string is produced by parsing the format string specified by FormatString.
209 Arguments are pulled from the variable argument list specified by Marker based on the
210 contents of the format string.
211 The number of Unicode characters in the produced output buffer is returned not including
214 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
215 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
217 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
218 unmodified and 0 is returned.
219 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
220 unmodified and 0 is returned.
221 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
222 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
223 buffer is unmodified and 0 is returned.
224 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
225 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
226 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
228 If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
230 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
232 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
233 @param FormatString A Null-terminated Unicode format string.
234 @param Marker VA_LIST marker for the variable argument list.
236 @return The number of Unicode characters in the produced output buffer not including the
243 OUT CHAR16
*StartOfBuffer
,
245 IN CONST CHAR16
*FormatString
,
250 Produces a Null-terminated Unicode string in an output buffer based on
251 a Null-terminated Unicode format string and a BASE_LIST argument list.
253 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
255 The Unicode string is produced by parsing the format string specified by FormatString.
256 Arguments are pulled from the variable argument list specified by Marker based on the
257 contents of the format string.
258 The number of Unicode characters in the produced output buffer is returned not including
261 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
262 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
264 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
265 unmodified and 0 is returned.
266 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
267 unmodified and 0 is returned.
268 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
269 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
270 buffer is unmodified and 0 is returned.
271 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
272 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
273 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
275 If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
277 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
279 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
280 @param FormatString A Null-terminated Unicode format string.
281 @param Marker BASE_LIST marker for the variable argument list.
283 @return The number of Unicode characters in the produced output buffer not including the
290 OUT CHAR16
*StartOfBuffer
,
292 IN CONST CHAR16
*FormatString
,
297 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
298 Unicode format string and variable argument list.
300 This function is similar as snprintf_s defined in C11.
302 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
304 The Unicode string is produced by parsing the format string specified by FormatString.
305 Arguments are pulled from the variable argument list based on the contents of the format string.
306 The number of Unicode characters in the produced output buffer is returned not including
309 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
310 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
312 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
313 unmodified and 0 is returned.
314 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
315 unmodified and 0 is returned.
316 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
317 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
318 buffer is unmodified and 0 is returned.
319 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
320 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
321 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
323 If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
325 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
327 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
328 @param FormatString A Null-terminated Unicode format string.
329 @param ... Variable argument list whose contents are accessed based on the
330 format string specified by FormatString.
332 @return The number of Unicode characters in the produced output buffer not including the
339 OUT CHAR16
*StartOfBuffer
,
341 IN CONST CHAR16
*FormatString
,
346 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
347 ASCII format string and a VA_LIST argument list.
349 This function is similar as vsnprintf_s defined in C11.
351 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
353 The Unicode string is produced by parsing the format string specified by FormatString.
354 Arguments are pulled from the variable argument list specified by Marker based on the
355 contents of the format string.
356 The number of Unicode characters in the produced output buffer is returned not including
359 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
361 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
362 unmodified and 0 is returned.
363 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
364 unmodified and 0 is returned.
365 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
366 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
367 buffer is unmodified and 0 is returned.
368 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
369 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
370 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
372 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
374 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
376 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
377 @param FormatString A Null-terminated ASCII format string.
378 @param Marker VA_LIST marker for the variable argument list.
380 @return The number of Unicode characters in the produced output buffer not including the
386 UnicodeVSPrintAsciiFormat (
387 OUT CHAR16
*StartOfBuffer
,
389 IN CONST CHAR8
*FormatString
,
394 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
395 ASCII format string and a BASE_LIST argument list.
397 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
399 The Unicode string is produced by parsing the format string specified by FormatString.
400 Arguments are pulled from the variable argument list specified by Marker based on the
401 contents of the format string.
402 The number of Unicode characters in the produced output buffer is returned not including
405 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
407 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
408 unmodified and 0 is returned.
409 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
410 unmodified and 0 is returned.
411 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
412 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
413 buffer is unmodified and 0 is returned.
414 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
415 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
416 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
418 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
420 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
422 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
423 @param FormatString A Null-terminated ASCII format string.
424 @param Marker BASE_LIST marker for the variable argument list.
426 @return The number of Unicode characters in the produced output buffer not including the
432 UnicodeBSPrintAsciiFormat (
433 OUT CHAR16
*StartOfBuffer
,
435 IN CONST CHAR8
*FormatString
,
440 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
441 ASCII format string and variable argument list.
443 This function is similar as snprintf_s defined in C11.
445 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
447 The Unicode string is produced by parsing the format string specified by FormatString.
448 Arguments are pulled from the variable argument list based on the contents of the
450 The number of Unicode characters in the produced output buffer is returned not including
453 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
455 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
456 unmodified and 0 is returned.
457 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
458 unmodified and 0 is returned.
459 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
460 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
461 buffer is unmodified and 0 is returned.
462 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
463 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
464 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
466 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
468 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
470 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
471 @param FormatString A Null-terminated ASCII format string.
472 @param ... Variable argument list whose contents are accessed based on the
473 format string specified by FormatString.
475 @return The number of Unicode characters in the produced output buffer not including the
481 UnicodeSPrintAsciiFormat (
482 OUT CHAR16
*StartOfBuffer
,
484 IN CONST CHAR8
*FormatString
,
489 Converts a decimal value to a Null-terminated Unicode string.
491 Converts the decimal number specified by Value to a Null-terminated Unicode
492 string specified by Buffer containing at most Width characters. No padding of
493 spaces is ever performed. If Width is 0 then a width of
494 MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than
495 Width characters, then only the first Width characters are placed in Buffer.
496 Additional conversion parameters are specified in Flags.
498 The Flags bit LEFT_JUSTIFY is always ignored.
499 All conversions are left justified in Buffer.
500 If Width is 0, PREFIX_ZERO is ignored in Flags.
501 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and
502 commas are inserted every 3rd digit starting from the right.
503 If RADIX_HEX is set in Flags, then the output buffer will be formatted in
505 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in
507 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then
508 Buffer is padded with '0' characters so the combination of the optional '-'
509 sign character, '0' characters, digit characters for Value, and the
510 Null-terminator add up to Width characters.
512 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
513 If an error would be returned, then the function will also ASSERT().
515 @param Buffer The pointer to the output buffer for the produced
516 Null-terminated Unicode string.
517 @param BufferSize The size of Buffer in bytes, including the
519 @param Flags The bitmask of flags that specify left justification,
520 zero pad, and commas.
521 @param Value The 64-bit signed value to convert to a string.
522 @param Width The maximum number of Unicode characters to place in
523 Buffer, not including the Null-terminator.
525 @retval RETURN_SUCCESS The decimal value is converted.
526 @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted
528 @retval RETURN_INVALID_PARAMETER If Buffer is NULL.
529 If PcdMaximumUnicodeStringLength is not
530 zero, and BufferSize is greater than
531 (PcdMaximumUnicodeStringLength *
532 sizeof (CHAR16) + 1).
533 If unsupported bits are set in Flags.
534 If both COMMA_TYPE and RADIX_HEX are set in
536 If Width >= MAXIMUM_VALUE_CHARACTERS.
541 UnicodeValueToStringS (
542 IN OUT CHAR16
*Buffer
,
550 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
551 ASCII format string and a VA_LIST argument list.
553 This function is similar as vsnprintf_s defined in C11.
555 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
557 The ASCII string is produced by parsing the format string specified by FormatString.
558 Arguments are pulled from the variable argument list specified by Marker based on
559 the contents of the format string.
560 The number of ASCII characters in the produced output buffer is returned not including
563 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
564 unmodified and 0 is returned.
565 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
566 unmodified and 0 is returned.
567 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
568 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
569 is unmodified and 0 is returned.
570 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
571 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
572 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
574 If BufferSize is 0, then no output buffer is produced and 0 is returned.
576 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
578 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
579 @param FormatString A Null-terminated ASCII format string.
580 @param Marker VA_LIST marker for the variable argument list.
582 @return The number of ASCII characters in the produced output buffer not including the
589 OUT CHAR8
*StartOfBuffer
,
591 IN CONST CHAR8
*FormatString
,
596 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
597 ASCII format string and a BASE_LIST argument list.
599 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
601 The ASCII string is produced by parsing the format string specified by FormatString.
602 Arguments are pulled from the variable argument list specified by Marker based on
603 the contents of the format string.
604 The number of ASCII characters in the produced output buffer is returned not including
607 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
608 unmodified and 0 is returned.
609 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
610 unmodified and 0 is returned.
611 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
612 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
613 is unmodified and 0 is returned.
614 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
615 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
616 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
618 If BufferSize is 0, then no output buffer is produced and 0 is returned.
620 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
622 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
623 @param FormatString A Null-terminated ASCII format string.
624 @param Marker BASE_LIST marker for the variable argument list.
626 @return The number of ASCII characters in the produced output buffer not including the
633 OUT CHAR8
*StartOfBuffer
,
635 IN CONST CHAR8
*FormatString
,
640 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
641 ASCII format string and variable argument list.
643 This function is similar as snprintf_s defined in C11.
645 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
647 The ASCII string is produced by parsing the format string specified by FormatString.
648 Arguments are pulled from the variable argument list based on the contents of the
650 The number of ASCII characters in the produced output buffer is returned not including
653 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
654 unmodified and 0 is returned.
655 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
656 unmodified and 0 is returned.
657 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
658 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
659 is unmodified and 0 is returned.
660 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
661 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
662 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
664 If BufferSize is 0, then no output buffer is produced and 0 is returned.
666 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
668 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
669 @param FormatString A Null-terminated ASCII format string.
670 @param ... Variable argument list whose contents are accessed based on the
671 format string specified by FormatString.
673 @return The number of ASCII characters in the produced output buffer not including the
680 OUT CHAR8
*StartOfBuffer
,
682 IN CONST CHAR8
*FormatString
,
687 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
688 Unicode format string and a VA_LIST argument list.
690 This function is similar as vsnprintf_s defined in C11.
692 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
694 The ASCII string is produced by parsing the format string specified by FormatString.
695 Arguments are pulled from the variable argument list specified by Marker based on
696 the contents of the format string.
697 The number of ASCII characters in the produced output buffer is returned not including
700 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
702 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
703 unmodified and 0 is returned.
704 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
705 unmodified and 0 is returned.
706 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
707 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
708 is unmodified and 0 is returned.
709 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
710 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
711 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
713 If BufferSize is 0, then no output buffer is produced and 0 is returned.
715 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
717 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
718 @param FormatString A Null-terminated Unicode format string.
719 @param Marker VA_LIST marker for the variable argument list.
721 @return The number of ASCII characters in the produced output buffer not including the
727 AsciiVSPrintUnicodeFormat (
728 OUT CHAR8
*StartOfBuffer
,
730 IN CONST CHAR16
*FormatString
,
735 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
736 Unicode format string and a BASE_LIST argument list.
738 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
740 The ASCII string is produced by parsing the format string specified by FormatString.
741 Arguments are pulled from the variable argument list specified by Marker based on
742 the contents of the format string.
743 The number of ASCII characters in the produced output buffer is returned not including
746 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
748 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
749 unmodified and 0 is returned.
750 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
751 unmodified and 0 is returned.
752 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
753 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
754 is unmodified and 0 is returned.
755 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
756 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
757 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
759 If BufferSize is 0, then no output buffer is produced and 0 is returned.
761 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
763 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
764 @param FormatString A Null-terminated Unicode format string.
765 @param Marker BASE_LIST marker for the variable argument list.
767 @return The number of ASCII characters in the produced output buffer not including the
773 AsciiBSPrintUnicodeFormat (
774 OUT CHAR8
*StartOfBuffer
,
776 IN CONST CHAR16
*FormatString
,
781 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
782 Unicode format string and variable argument list.
784 This function is similar as snprintf_s defined in C11.
786 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
788 The ASCII string is produced by parsing the format string specified by FormatString.
789 Arguments are pulled from the variable argument list based on the contents of the
791 The number of ASCII characters in the produced output buffer is returned not including
794 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
796 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
797 unmodified and 0 is returned.
798 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
799 unmodified and 0 is returned.
800 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
801 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
802 is unmodified and 0 is returned.
803 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
804 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
805 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
807 If BufferSize is 0, then no output buffer is produced and 0 is returned.
809 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
811 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
812 @param FormatString A Null-terminated Unicode format string.
813 @param ... Variable argument list whose contents are accessed based on the
814 format string specified by FormatString.
816 @return The number of ASCII characters in the produced output buffer not including the
822 AsciiSPrintUnicodeFormat (
823 OUT CHAR8
*StartOfBuffer
,
825 IN CONST CHAR16
*FormatString
,
830 Converts a decimal value to a Null-terminated Ascii string.
832 Converts the decimal number specified by Value to a Null-terminated Ascii
833 string specified by Buffer containing at most Width characters. No padding of
834 spaces is ever performed. If Width is 0 then a width of
835 MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than
836 Width characters, then only the first Width characters are placed in Buffer.
837 Additional conversion parameters are specified in Flags.
839 The Flags bit LEFT_JUSTIFY is always ignored.
840 All conversions are left justified in Buffer.
841 If Width is 0, PREFIX_ZERO is ignored in Flags.
842 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and
843 commas are inserted every 3rd digit starting from the right.
844 If RADIX_HEX is set in Flags, then the output buffer will be formatted in
846 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in
848 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then
849 Buffer is padded with '0' characters so the combination of the optional '-'
850 sign character, '0' characters, digit characters for Value, and the
851 Null-terminator add up to Width characters.
853 If an error would be returned, then the function will ASSERT().
855 @param Buffer The pointer to the output buffer for the produced
856 Null-terminated Ascii string.
857 @param BufferSize The size of Buffer in bytes, including the
859 @param Flags The bitmask of flags that specify left justification,
860 zero pad, and commas.
861 @param Value The 64-bit signed value to convert to a string.
862 @param Width The maximum number of Ascii characters to place in
863 Buffer, not including the Null-terminator.
865 @retval RETURN_SUCCESS The decimal value is converted.
866 @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted
868 @retval RETURN_INVALID_PARAMETER If Buffer is NULL.
869 If PcdMaximumAsciiStringLength is not
870 zero, and BufferSize is greater than
871 PcdMaximumAsciiStringLength.
872 If unsupported bits are set in Flags.
873 If both COMMA_TYPE and RADIX_HEX are set in
875 If Width >= MAXIMUM_VALUE_CHARACTERS.
880 AsciiValueToStringS (
881 IN OUT CHAR8
*Buffer
,
889 Returns the number of characters that would be produced by if the formatted
890 output were produced not including the Null-terminator.
892 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
894 If FormatString is NULL, then ASSERT() and 0 is returned.
895 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more
896 than PcdMaximumUnicodeStringLength Unicode characters not including the
897 Null-terminator, then ASSERT() and 0 is returned.
899 @param[in] FormatString A Null-terminated Unicode format string.
900 @param[in] Marker VA_LIST marker for the variable argument list.
902 @return The number of characters that would be produced, not including the
908 IN CONST CHAR16
*FormatString
,
913 Returns the number of characters that would be produced by if the formatted
914 output were produced not including the Null-terminator.
916 If FormatString is NULL, then ASSERT() and 0 is returned.
917 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more
918 than PcdMaximumAsciiStringLength Ascii characters not including the
919 Null-terminator, then ASSERT() and 0 is returned.
921 @param[in] FormatString A Null-terminated ASCII format string.
922 @param[in] Marker VA_LIST marker for the variable argument list.
924 @return The number of characters that would be produced, not including the
929 SPrintLengthAsciiFormat (
930 IN CONST CHAR8
*FormatString
,