xref: /freebsd-src/sys/contrib/edk2/Include/Library/PrintLib.h (revision 3245fa215aca18d135839a15c80ae1c905666a37)
10d1ba665SWarner Losh /** @file
20d1ba665SWarner Losh   Provides services to print a formatted string to a buffer. All combinations of
30d1ba665SWarner Losh   Unicode and ASCII strings are supported.
40d1ba665SWarner Losh 
5*3245fa21SMitchell Horne Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6*3245fa21SMitchell Horne SPDX-License-Identifier: BSD-2-Clause-Patent
70d1ba665SWarner Losh 
80d1ba665SWarner Losh   The Print Library functions provide a simple means to produce formatted output
90d1ba665SWarner Losh   strings.  Many of the output functions use a format string to describe how to
100d1ba665SWarner Losh   format the output of variable arguments.  The format string consists of normal
110d1ba665SWarner Losh   text and argument descriptors.  There are no restrictions for how the normal
120d1ba665SWarner Losh   text and argument descriptors can be mixed.  The following end of line(EOL)
130d1ba665SWarner Losh   translations must be performed on the contents of the format string:
140d1ba665SWarner Losh 
150d1ba665SWarner Losh      - '\\r' is translated to '\\r'
160d1ba665SWarner Losh      - '\\r\\n' is translated to '\\r\\n'
170d1ba665SWarner Losh      - '\\n' is translated to '\\r\\n'
180d1ba665SWarner Losh      - '\\n\\r' is translated to '\\r\\n'
190d1ba665SWarner Losh 
200d1ba665SWarner Losh   This does not follow the ANSI C standard for sprint().  The format of argument
210d1ba665SWarner Losh   descriptors is described below.  The ANSI C standard for sprint() has been
220d1ba665SWarner Losh   followed for some of the format types, and has not been followed for others.
230d1ba665SWarner Losh   The exceptions are noted below.
240d1ba665SWarner Losh 
250d1ba665SWarner Losh     %[flags][width][.precision]type
260d1ba665SWarner Losh 
270d1ba665SWarner Losh   [flags]:
280d1ba665SWarner Losh     - -
290d1ba665SWarner Losh       - The field is left justified.  If not flag is not specified, then the
300d1ba665SWarner Losh         field is right justified.
310d1ba665SWarner Losh     - space
320d1ba665SWarner Losh       - Prefix a space character to a number.  Only valid for types X, x, and d.
330d1ba665SWarner Losh     - +
340d1ba665SWarner Losh       - Prefix a plus character to a number.  Only valid for types X, x, and d.
350d1ba665SWarner Losh         If both space and + are specified, then space is ignored.
360d1ba665SWarner Losh     - 0
370d1ba665SWarner Losh       - Pad with 0 characters to the left of a number.  Only valid for types
380d1ba665SWarner Losh         X, x, and d.
390d1ba665SWarner Losh     - ,
400d1ba665SWarner Losh       - Place a comma every 3rd digit of the number.  Only valid for type d.
410d1ba665SWarner Losh         If 0 is also specified, then 0 is ignored.
420d1ba665SWarner Losh     - L, l
430d1ba665SWarner Losh       - The number being printed is size UINT64.  Only valid for types X, x, and d.
440d1ba665SWarner Losh         If this flag is not specified, then the number being printed is size int.
450d1ba665SWarner Losh     - NOTE: All invalid flags are ignored.
460d1ba665SWarner Losh 
470d1ba665SWarner Losh   [width]:
480d1ba665SWarner Losh 
490d1ba665SWarner Losh     - *
500d1ba665SWarner Losh       - The width of the field is specified by a UINTN argument in the
510d1ba665SWarner Losh         argument list.
520d1ba665SWarner Losh     - number
530d1ba665SWarner Losh       - The number specified as a decimal value represents the width of
540d1ba665SWarner Losh         the field.
550d1ba665SWarner Losh     - NOTE: If [width] is not specified, then a field width of 0 is assumed.
560d1ba665SWarner Losh 
570d1ba665SWarner Losh   [.precision]:
580d1ba665SWarner Losh 
590d1ba665SWarner Losh     - *
600d1ba665SWarner Losh       - The precision of the field is specified by a UINTN argument in the
610d1ba665SWarner Losh         argument list.
620d1ba665SWarner Losh     - number
630d1ba665SWarner Losh       - The number specified as a decimal value represents the precision of
640d1ba665SWarner Losh         the field.
650d1ba665SWarner Losh     - NOTE: If [.precision] is not specified, then a precision of 0 is assumed.
660d1ba665SWarner Losh 
670d1ba665SWarner Losh   type:
680d1ba665SWarner Losh 
690d1ba665SWarner Losh     - %
700d1ba665SWarner Losh       - Print a %%.
710d1ba665SWarner Losh     - c
720d1ba665SWarner Losh       - The argument is a Unicode character.  ASCII characters can be printed
730d1ba665SWarner Losh         using this type too by making sure bits 8..15 of the argument are set to 0.
740d1ba665SWarner Losh     - x
750d1ba665SWarner Losh       - The argument is an unsigned hexadecimal number.  The characters used are 0..9 and
760d1ba665SWarner Losh         A..F.  If the flag 'L' is not specified, then the argument is assumed
770d1ba665SWarner Losh         to be size int.  This does not follow ANSI C.
780d1ba665SWarner Losh     - X
790d1ba665SWarner Losh       - The argument is an unsigned hexadecimal number and the number is padded with
800d1ba665SWarner Losh         zeros.  This is equivalent to a format string of "0x". If the flag
810d1ba665SWarner Losh         'L' is not specified, then the argument is assumed to be size int.
820d1ba665SWarner Losh         This does not follow ANSI C.
830d1ba665SWarner Losh     - d
840d1ba665SWarner Losh       - The argument is a signed decimal number.  If the flag 'L' is not specified,
850d1ba665SWarner Losh         then the argument is assumed to be size int.
860d1ba665SWarner Losh     - u
870d1ba665SWarner Losh       - The argument is a unsigned decimal number.  If the flag 'L' is not specified,
880d1ba665SWarner Losh         then the argument is assumed to be size int.
890d1ba665SWarner Losh     - p
900d1ba665SWarner Losh       - The argument is a pointer that is a (VOID *), and it is printed as an
910d1ba665SWarner Losh         unsigned hexadecimal number  The characters used are 0..9 and A..F.
920d1ba665SWarner Losh     - a
930d1ba665SWarner Losh       - The argument is a pointer to an ASCII string.
940d1ba665SWarner Losh         This does not follow ANSI C.
950d1ba665SWarner Losh     - S, s
960d1ba665SWarner Losh       - The argument is a pointer to a Unicode string.
970d1ba665SWarner Losh         This does not follow ANSI C.
980d1ba665SWarner Losh     - g
990d1ba665SWarner Losh       - The argument is a pointer to a GUID structure.  The GUID is printed
1000d1ba665SWarner Losh         in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
1010d1ba665SWarner Losh         This does not follow ANSI C.
1020d1ba665SWarner Losh     - t
1030d1ba665SWarner Losh       - The argument is a pointer to an EFI_TIME structure.  The time and
1040d1ba665SWarner Losh         date are printed in the format "mm/dd/yyyy hh:mm" where mm is the
1050d1ba665SWarner Losh         month zero padded, dd is the day zero padded, yyyy is the year zero
1060d1ba665SWarner Losh         padded, hh is the hour zero padded, and mm is minutes zero padded.
1070d1ba665SWarner Losh         This does not follow ANSI C.
1080d1ba665SWarner Losh     - r
1090d1ba665SWarner Losh       - The argument is a RETURN_STATUS value.  This value is converted to
1100d1ba665SWarner Losh         a string following the table below.  This does not follow ANSI C.
1110d1ba665SWarner Losh       - RETURN_SUCCESS
1120d1ba665SWarner Losh         - "Success"
1130d1ba665SWarner Losh       - RETURN_LOAD_ERROR
1140d1ba665SWarner Losh         - "Load Error"
1150d1ba665SWarner Losh       - RETURN_INVALID_PARAMETER
1160d1ba665SWarner Losh         - "Invalid Parameter"
1170d1ba665SWarner Losh       - RETURN_UNSUPPORTED
1180d1ba665SWarner Losh         - "Unsupported"
1190d1ba665SWarner Losh       - RETURN_BAD_BUFFER_SIZE
1200d1ba665SWarner Losh         - "Bad Buffer Size"
1210d1ba665SWarner Losh       - RETURN_BUFFER_TOO_SMALL
1220d1ba665SWarner Losh         - "Buffer Too Small"
1230d1ba665SWarner Losh       - RETURN_NOT_READY
1240d1ba665SWarner Losh         - "Not Ready"
1250d1ba665SWarner Losh       - RETURN_DEVICE_ERROR
1260d1ba665SWarner Losh         - "Device Error"
1270d1ba665SWarner Losh       - RETURN_WRITE_PROTECTED
1280d1ba665SWarner Losh         - "Write Protected"
1290d1ba665SWarner Losh       - RETURN_OUT_OF_RESOURCES
1300d1ba665SWarner Losh         - "Out of Resources"
1310d1ba665SWarner Losh       - RETURN_VOLUME_CORRUPTED
1320d1ba665SWarner Losh         - "Volume Corrupt"
1330d1ba665SWarner Losh       - RETURN_VOLUME_FULL
1340d1ba665SWarner Losh         - "Volume Full"
1350d1ba665SWarner Losh       - RETURN_NO_MEDIA
1360d1ba665SWarner Losh         - "No Media"
1370d1ba665SWarner Losh       - RETURN_MEDIA_CHANGED
1380d1ba665SWarner Losh         - "Media changed"
1390d1ba665SWarner Losh       - RETURN_NOT_FOUND
1400d1ba665SWarner Losh         - "Not Found"
1410d1ba665SWarner Losh       - RETURN_ACCESS_DENIED
1420d1ba665SWarner Losh         - "Access Denied"
1430d1ba665SWarner Losh       - RETURN_NO_RESPONSE
1440d1ba665SWarner Losh         - "No Response"
1450d1ba665SWarner Losh       - RETURN_NO_MAPPING
1460d1ba665SWarner Losh         - "No mapping"
1470d1ba665SWarner Losh       - RETURN_TIMEOUT
1480d1ba665SWarner Losh         - "Time out"
1490d1ba665SWarner Losh       - RETURN_NOT_STARTED
1500d1ba665SWarner Losh         - "Not started"
1510d1ba665SWarner Losh       - RETURN_ALREADY_STARTED
1520d1ba665SWarner Losh         - "Already started"
1530d1ba665SWarner Losh       - RETURN_ABORTED
1540d1ba665SWarner Losh         - "Aborted"
1550d1ba665SWarner Losh       - RETURN_ICMP_ERROR
1560d1ba665SWarner Losh         - "ICMP Error"
1570d1ba665SWarner Losh       - RETURN_TFTP_ERROR
1580d1ba665SWarner Losh         - "TFTP Error"
1590d1ba665SWarner Losh       - RETURN_PROTOCOL_ERROR
1600d1ba665SWarner Losh         - "Protocol Error"
1610d1ba665SWarner Losh       - RETURN_WARN_UNKNOWN_GLYPH
1620d1ba665SWarner Losh         - "Warning Unknown Glyph"
1630d1ba665SWarner Losh       - RETURN_WARN_DELETE_FAILURE
1640d1ba665SWarner Losh         - "Warning Delete Failure"
1650d1ba665SWarner Losh       - RETURN_WARN_WRITE_FAILURE
1660d1ba665SWarner Losh         - "Warning Write Failure"
1670d1ba665SWarner Losh       - RETURN_WARN_BUFFER_TOO_SMALL
1680d1ba665SWarner Losh         - "Warning Buffer Too Small"
1690d1ba665SWarner Losh 
1700d1ba665SWarner Losh **/
1710d1ba665SWarner Losh 
1720d1ba665SWarner Losh #ifndef __PRINT_LIB_H__
1730d1ba665SWarner Losh #define __PRINT_LIB_H__
1740d1ba665SWarner Losh 
1750d1ba665SWarner Losh ///
1760d1ba665SWarner Losh /// Define the maximum number of characters that are required to
1770d1ba665SWarner Losh /// encode with a NULL terminator a decimal, hexadecimal, GUID,
1780d1ba665SWarner Losh /// or TIME value.
1790d1ba665SWarner Losh ///
1800d1ba665SWarner Losh ///  Maximum Length Decimal String     = 28
1810d1ba665SWarner Losh ///    "-9,223,372,036,854,775,808"
1820d1ba665SWarner Losh ///  Maximum Length Hexadecimal String = 17
1830d1ba665SWarner Losh ///    "FFFFFFFFFFFFFFFF"
1840d1ba665SWarner Losh ///  Maximum Length GUID               = 37
1850d1ba665SWarner Losh ///    "00000000-0000-0000-0000-000000000000"
1860d1ba665SWarner Losh ///  Maximum Length TIME               = 18
1870d1ba665SWarner Losh ///    "12/12/2006  12:12"
1880d1ba665SWarner Losh ///
1890d1ba665SWarner Losh #define MAXIMUM_VALUE_CHARACTERS  38
1900d1ba665SWarner Losh 
1910d1ba665SWarner Losh ///
1920d1ba665SWarner Losh /// Flags bitmask values use in UnicodeValueToString() and
1930d1ba665SWarner Losh /// AsciiValueToString()
1940d1ba665SWarner Losh ///
1950d1ba665SWarner Losh #define LEFT_JUSTIFY      0x01
1960d1ba665SWarner Losh #define COMMA_TYPE        0x08
1970d1ba665SWarner Losh #define PREFIX_ZERO       0x20
1980d1ba665SWarner Losh #define RADIX_HEX         0x80
1990d1ba665SWarner Losh 
2000d1ba665SWarner Losh /**
2010d1ba665SWarner Losh   Produces a Null-terminated Unicode string in an output buffer based on
2020d1ba665SWarner Losh   a Null-terminated Unicode format string and a VA_LIST argument list.
2030d1ba665SWarner Losh 
2040d1ba665SWarner Losh   This function is similar as vsnprintf_s defined in C11.
2050d1ba665SWarner Losh 
2060d1ba665SWarner Losh   Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
2070d1ba665SWarner Losh   and BufferSize.
2080d1ba665SWarner Losh   The Unicode string is produced by parsing the format string specified by FormatString.
2090d1ba665SWarner Losh   Arguments are pulled from the variable argument list specified by Marker based on the
2100d1ba665SWarner Losh   contents of the format string.
2110d1ba665SWarner Losh   The number of Unicode characters in the produced output buffer is returned not including
2120d1ba665SWarner Losh   the Null-terminator.
2130d1ba665SWarner Losh 
2140d1ba665SWarner Losh   If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
2150d1ba665SWarner Losh   If FormatString is not aligned on a 16-bit boundary, then ASSERT().
2160d1ba665SWarner Losh 
2170d1ba665SWarner Losh   If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
2180d1ba665SWarner Losh   unmodified and 0 is returned.
2190d1ba665SWarner Losh   If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
2200d1ba665SWarner Losh   unmodified and 0 is returned.
2210d1ba665SWarner Losh   If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
2220d1ba665SWarner Losh   (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
2230d1ba665SWarner Losh   buffer is unmodified and 0 is returned.
2240d1ba665SWarner Losh   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
2250d1ba665SWarner Losh   PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
2260d1ba665SWarner Losh   ASSERT(). Also, the output buffer is unmodified and 0 is returned.
2270d1ba665SWarner Losh 
2280d1ba665SWarner Losh   If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
2290d1ba665SWarner Losh 
2300d1ba665SWarner Losh   @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
2310d1ba665SWarner Losh                           Unicode string.
2320d1ba665SWarner Losh   @param  BufferSize      The size, in bytes, of the output buffer specified by StartOfBuffer.
2330d1ba665SWarner Losh   @param  FormatString    A Null-terminated Unicode format string.
2340d1ba665SWarner Losh   @param  Marker          VA_LIST marker for the variable argument list.
2350d1ba665SWarner Losh 
2360d1ba665SWarner Losh   @return The number of Unicode characters in the produced output buffer not including the
2370d1ba665SWarner Losh           Null-terminator.
2380d1ba665SWarner Losh 
2390d1ba665SWarner Losh **/
2400d1ba665SWarner Losh UINTN
2410d1ba665SWarner Losh EFIAPI
2420d1ba665SWarner Losh UnicodeVSPrint (
2430d1ba665SWarner Losh   OUT CHAR16        *StartOfBuffer,
2440d1ba665SWarner Losh   IN  UINTN         BufferSize,
2450d1ba665SWarner Losh   IN  CONST CHAR16  *FormatString,
2460d1ba665SWarner Losh   IN  VA_LIST       Marker
2470d1ba665SWarner Losh   );
2480d1ba665SWarner Losh 
2490d1ba665SWarner Losh /**
2500d1ba665SWarner Losh   Produces a Null-terminated Unicode string in an output buffer based on
2510d1ba665SWarner Losh   a Null-terminated Unicode format string and a BASE_LIST argument list.
2520d1ba665SWarner Losh 
2530d1ba665SWarner Losh   Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
2540d1ba665SWarner Losh   and BufferSize.
2550d1ba665SWarner Losh   The Unicode string is produced by parsing the format string specified by FormatString.
2560d1ba665SWarner Losh   Arguments are pulled from the variable argument list specified by Marker based on the
2570d1ba665SWarner Losh   contents of the format string.
2580d1ba665SWarner Losh   The number of Unicode characters in the produced output buffer is returned not including
2590d1ba665SWarner Losh   the Null-terminator.
2600d1ba665SWarner Losh 
2610d1ba665SWarner Losh   If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
2620d1ba665SWarner Losh   If FormatString is not aligned on a 16-bit boundary, then ASSERT().
2630d1ba665SWarner Losh 
2640d1ba665SWarner Losh   If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
2650d1ba665SWarner Losh   unmodified and 0 is returned.
2660d1ba665SWarner Losh   If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
2670d1ba665SWarner Losh   unmodified and 0 is returned.
2680d1ba665SWarner Losh   If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
2690d1ba665SWarner Losh   (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
2700d1ba665SWarner Losh   buffer is unmodified and 0 is returned.
2710d1ba665SWarner Losh   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
2720d1ba665SWarner Losh   PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
2730d1ba665SWarner Losh   ASSERT(). Also, the output buffer is unmodified and 0 is returned.
2740d1ba665SWarner Losh 
2750d1ba665SWarner Losh   If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
2760d1ba665SWarner Losh 
2770d1ba665SWarner Losh   @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
2780d1ba665SWarner Losh                           Unicode string.
2790d1ba665SWarner Losh   @param  BufferSize      The size, in bytes, of the output buffer specified by StartOfBuffer.
2800d1ba665SWarner Losh   @param  FormatString    A Null-terminated Unicode format string.
2810d1ba665SWarner Losh   @param  Marker          BASE_LIST marker for the variable argument list.
2820d1ba665SWarner Losh 
2830d1ba665SWarner Losh   @return The number of Unicode characters in the produced output buffer not including the
2840d1ba665SWarner Losh           Null-terminator.
2850d1ba665SWarner Losh 
2860d1ba665SWarner Losh **/
2870d1ba665SWarner Losh UINTN
2880d1ba665SWarner Losh EFIAPI
2890d1ba665SWarner Losh UnicodeBSPrint (
2900d1ba665SWarner Losh   OUT CHAR16        *StartOfBuffer,
2910d1ba665SWarner Losh   IN  UINTN         BufferSize,
2920d1ba665SWarner Losh   IN  CONST CHAR16  *FormatString,
2930d1ba665SWarner Losh   IN  BASE_LIST     Marker
2940d1ba665SWarner Losh   );
2950d1ba665SWarner Losh 
2960d1ba665SWarner Losh /**
2970d1ba665SWarner Losh   Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
2980d1ba665SWarner Losh   Unicode format string and variable argument list.
2990d1ba665SWarner Losh 
3000d1ba665SWarner Losh   This function is similar as snprintf_s defined in C11.
3010d1ba665SWarner Losh 
3020d1ba665SWarner Losh   Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
3030d1ba665SWarner Losh   and BufferSize.
3040d1ba665SWarner Losh   The Unicode string is produced by parsing the format string specified by FormatString.
3050d1ba665SWarner Losh   Arguments are pulled from the variable argument list based on the contents of the format string.
3060d1ba665SWarner Losh   The number of Unicode characters in the produced output buffer is returned not including
3070d1ba665SWarner Losh   the Null-terminator.
3080d1ba665SWarner Losh 
3090d1ba665SWarner Losh   If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
3100d1ba665SWarner Losh   If FormatString is not aligned on a 16-bit boundary, then ASSERT().
3110d1ba665SWarner Losh 
3120d1ba665SWarner Losh   If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
3130d1ba665SWarner Losh   unmodified and 0 is returned.
3140d1ba665SWarner Losh   If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
3150d1ba665SWarner Losh   unmodified and 0 is returned.
3160d1ba665SWarner Losh   If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
3170d1ba665SWarner Losh   (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
3180d1ba665SWarner Losh   buffer is unmodified and 0 is returned.
3190d1ba665SWarner Losh   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
3200d1ba665SWarner Losh   PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
3210d1ba665SWarner Losh   ASSERT(). Also, the output buffer is unmodified and 0 is returned.
3220d1ba665SWarner Losh 
3230d1ba665SWarner Losh   If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
3240d1ba665SWarner Losh 
3250d1ba665SWarner Losh   @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
3260d1ba665SWarner Losh                           Unicode string.
3270d1ba665SWarner Losh   @param  BufferSize      The size, in bytes, of the output buffer specified by StartOfBuffer.
3280d1ba665SWarner Losh   @param  FormatString    A Null-terminated Unicode format string.
3290d1ba665SWarner Losh   @param  ...             Variable argument list whose contents are accessed based on the
3300d1ba665SWarner Losh                           format string specified by FormatString.
3310d1ba665SWarner Losh 
3320d1ba665SWarner Losh   @return The number of Unicode characters in the produced output buffer not including the
3330d1ba665SWarner Losh           Null-terminator.
3340d1ba665SWarner Losh 
3350d1ba665SWarner Losh **/
3360d1ba665SWarner Losh UINTN
3370d1ba665SWarner Losh EFIAPI
3380d1ba665SWarner Losh UnicodeSPrint (
3390d1ba665SWarner Losh   OUT CHAR16        *StartOfBuffer,
3400d1ba665SWarner Losh   IN  UINTN         BufferSize,
3410d1ba665SWarner Losh   IN  CONST CHAR16  *FormatString,
3420d1ba665SWarner Losh   ...
3430d1ba665SWarner Losh   );
3440d1ba665SWarner Losh 
3450d1ba665SWarner Losh /**
3460d1ba665SWarner Losh   Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
3470d1ba665SWarner Losh   ASCII format string and a VA_LIST argument list.
3480d1ba665SWarner Losh 
3490d1ba665SWarner Losh   This function is similar as vsnprintf_s defined in C11.
3500d1ba665SWarner Losh 
3510d1ba665SWarner Losh   Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
3520d1ba665SWarner Losh   and BufferSize.
3530d1ba665SWarner Losh   The Unicode string is produced by parsing the format string specified by FormatString.
3540d1ba665SWarner Losh   Arguments are pulled from the variable argument list specified by Marker based on the
3550d1ba665SWarner Losh   contents of the format string.
3560d1ba665SWarner Losh   The number of Unicode characters in the produced output buffer is returned not including
3570d1ba665SWarner Losh   the Null-terminator.
3580d1ba665SWarner Losh 
3590d1ba665SWarner Losh   If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
3600d1ba665SWarner Losh 
3610d1ba665SWarner Losh   If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
3620d1ba665SWarner Losh   unmodified and 0 is returned.
3630d1ba665SWarner Losh   If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
3640d1ba665SWarner Losh   unmodified and 0 is returned.
3650d1ba665SWarner Losh   If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
3660d1ba665SWarner Losh   (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
3670d1ba665SWarner Losh   buffer is unmodified and 0 is returned.
3680d1ba665SWarner Losh   If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
3690d1ba665SWarner Losh   PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
3700d1ba665SWarner Losh   ASSERT(). Also, the output buffer is unmodified and 0 is returned.
3710d1ba665SWarner Losh 
3720d1ba665SWarner Losh   If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
3730d1ba665SWarner Losh 
3740d1ba665SWarner Losh   @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
3750d1ba665SWarner Losh                           Unicode string.
3760d1ba665SWarner Losh   @param  BufferSize      The size, in bytes, of the output buffer specified by StartOfBuffer.
3770d1ba665SWarner Losh   @param  FormatString    A Null-terminated ASCII format string.
3780d1ba665SWarner Losh   @param  Marker          VA_LIST marker for the variable argument list.
3790d1ba665SWarner Losh 
3800d1ba665SWarner Losh   @return The number of Unicode characters in the produced output buffer not including the
3810d1ba665SWarner Losh           Null-terminator.
3820d1ba665SWarner Losh 
3830d1ba665SWarner Losh **/
3840d1ba665SWarner Losh UINTN
3850d1ba665SWarner Losh EFIAPI
3860d1ba665SWarner Losh UnicodeVSPrintAsciiFormat (
3870d1ba665SWarner Losh   OUT CHAR16       *StartOfBuffer,
3880d1ba665SWarner Losh   IN  UINTN        BufferSize,
3890d1ba665SWarner Losh   IN  CONST CHAR8  *FormatString,
3900d1ba665SWarner Losh   IN  VA_LIST      Marker
3910d1ba665SWarner Losh   );
3920d1ba665SWarner Losh 
3930d1ba665SWarner Losh /**
3940d1ba665SWarner Losh   Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
3950d1ba665SWarner Losh   ASCII format string and a BASE_LIST argument list.
3960d1ba665SWarner Losh 
3970d1ba665SWarner Losh   Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
3980d1ba665SWarner Losh   and BufferSize.
3990d1ba665SWarner Losh   The Unicode string is produced by parsing the format string specified by FormatString.
4000d1ba665SWarner Losh   Arguments are pulled from the variable argument list specified by Marker based on the
4010d1ba665SWarner Losh   contents of the format string.
4020d1ba665SWarner Losh   The number of Unicode characters in the produced output buffer is returned not including
4030d1ba665SWarner Losh   the Null-terminator.
4040d1ba665SWarner Losh 
4050d1ba665SWarner Losh   If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
4060d1ba665SWarner Losh 
4070d1ba665SWarner Losh   If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
4080d1ba665SWarner Losh   unmodified and 0 is returned.
4090d1ba665SWarner Losh   If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
4100d1ba665SWarner Losh   unmodified and 0 is returned.
4110d1ba665SWarner Losh   If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
4120d1ba665SWarner Losh   (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
4130d1ba665SWarner Losh   buffer is unmodified and 0 is returned.
4140d1ba665SWarner Losh   If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
4150d1ba665SWarner Losh   PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
4160d1ba665SWarner Losh   ASSERT(). Also, the output buffer is unmodified and 0 is returned.
4170d1ba665SWarner Losh 
4180d1ba665SWarner Losh   If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
4190d1ba665SWarner Losh 
4200d1ba665SWarner Losh   @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
4210d1ba665SWarner Losh                           Unicode string.
4220d1ba665SWarner Losh   @param  BufferSize      The size, in bytes, of the output buffer specified by StartOfBuffer.
4230d1ba665SWarner Losh   @param  FormatString    A Null-terminated ASCII format string.
4240d1ba665SWarner Losh   @param  Marker          BASE_LIST marker for the variable argument list.
4250d1ba665SWarner Losh 
4260d1ba665SWarner Losh   @return The number of Unicode characters in the produced output buffer not including the
4270d1ba665SWarner Losh           Null-terminator.
4280d1ba665SWarner Losh 
4290d1ba665SWarner Losh **/
4300d1ba665SWarner Losh UINTN
4310d1ba665SWarner Losh EFIAPI
4320d1ba665SWarner Losh UnicodeBSPrintAsciiFormat (
4330d1ba665SWarner Losh   OUT CHAR16       *StartOfBuffer,
4340d1ba665SWarner Losh   IN  UINTN        BufferSize,
4350d1ba665SWarner Losh   IN  CONST CHAR8  *FormatString,
4360d1ba665SWarner Losh   IN  BASE_LIST    Marker
4370d1ba665SWarner Losh   );
4380d1ba665SWarner Losh 
4390d1ba665SWarner Losh /**
4400d1ba665SWarner Losh   Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
4410d1ba665SWarner Losh   ASCII format string and  variable argument list.
4420d1ba665SWarner Losh 
4430d1ba665SWarner Losh   This function is similar as snprintf_s defined in C11.
4440d1ba665SWarner Losh 
4450d1ba665SWarner Losh   Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
4460d1ba665SWarner Losh   and BufferSize.
4470d1ba665SWarner Losh   The Unicode string is produced by parsing the format string specified by FormatString.
4480d1ba665SWarner Losh   Arguments are pulled from the variable argument list based on the contents of the
4490d1ba665SWarner Losh   format string.
4500d1ba665SWarner Losh   The number of Unicode characters in the produced output buffer is returned not including
4510d1ba665SWarner Losh   the Null-terminator.
4520d1ba665SWarner Losh 
4530d1ba665SWarner Losh   If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
4540d1ba665SWarner Losh 
4550d1ba665SWarner Losh   If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
4560d1ba665SWarner Losh   unmodified and 0 is returned.
4570d1ba665SWarner Losh   If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
4580d1ba665SWarner Losh   unmodified and 0 is returned.
4590d1ba665SWarner Losh   If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
4600d1ba665SWarner Losh   (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
4610d1ba665SWarner Losh   buffer is unmodified and 0 is returned.
4620d1ba665SWarner Losh   If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
4630d1ba665SWarner Losh   PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
4640d1ba665SWarner Losh   ASSERT(). Also, the output buffer is unmodified and 0 is returned.
4650d1ba665SWarner Losh 
4660d1ba665SWarner Losh   If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
4670d1ba665SWarner Losh 
4680d1ba665SWarner Losh   @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
4690d1ba665SWarner Losh                           Unicode string.
4700d1ba665SWarner Losh   @param  BufferSize      The size, in bytes, of the output buffer specified by StartOfBuffer.
4710d1ba665SWarner Losh   @param  FormatString    A Null-terminated ASCII format string.
4720d1ba665SWarner Losh   @param  ...             Variable argument list whose contents are accessed based on the
4730d1ba665SWarner Losh                           format string specified by FormatString.
4740d1ba665SWarner Losh 
4750d1ba665SWarner Losh   @return The number of Unicode characters in the produced output buffer not including the
4760d1ba665SWarner Losh           Null-terminator.
4770d1ba665SWarner Losh 
4780d1ba665SWarner Losh **/
4790d1ba665SWarner Losh UINTN
4800d1ba665SWarner Losh EFIAPI
4810d1ba665SWarner Losh UnicodeSPrintAsciiFormat (
4820d1ba665SWarner Losh   OUT CHAR16       *StartOfBuffer,
4830d1ba665SWarner Losh   IN  UINTN        BufferSize,
4840d1ba665SWarner Losh   IN  CONST CHAR8  *FormatString,
4850d1ba665SWarner Losh   ...
4860d1ba665SWarner Losh   );
4870d1ba665SWarner Losh 
4880d1ba665SWarner Losh #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
4890d1ba665SWarner Losh 
4900d1ba665SWarner Losh /**
4910d1ba665SWarner Losh   [ATTENTION] This function is deprecated for security reason.
4920d1ba665SWarner Losh 
4930d1ba665SWarner Losh   Converts a decimal value to a Null-terminated Unicode string.
4940d1ba665SWarner Losh 
4950d1ba665SWarner Losh   Converts the decimal number specified by Value to a Null-terminated Unicode
4960d1ba665SWarner Losh   string specified by Buffer containing at most Width characters. No padding of spaces
4970d1ba665SWarner Losh   is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
4980d1ba665SWarner Losh   The number of Unicode characters in Buffer is returned, not including the Null-terminator.
4990d1ba665SWarner Losh   If the conversion contains more than Width characters, then only the first
5000d1ba665SWarner Losh   Width characters are returned, and the total number of characters
5010d1ba665SWarner Losh   required to perform the conversion is returned.
5020d1ba665SWarner Losh   Additional conversion parameters are specified in Flags.
5030d1ba665SWarner Losh 
5040d1ba665SWarner Losh   The Flags bit LEFT_JUSTIFY is always ignored.
5050d1ba665SWarner Losh   All conversions are left justified in Buffer.
5060d1ba665SWarner Losh   If Width is 0, PREFIX_ZERO is ignored in Flags.
5070d1ba665SWarner Losh   If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
5080d1ba665SWarner Losh   are inserted every 3rd digit starting from the right.
5090d1ba665SWarner Losh   If RADIX_HEX is set in Flags, then the output buffer will be
5100d1ba665SWarner Losh   formatted in hexadecimal format.
5110d1ba665SWarner Losh   If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
5120d1ba665SWarner Losh   If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
5130d1ba665SWarner Losh   then Buffer is padded with '0' characters so the combination of the optional '-'
5140d1ba665SWarner Losh   sign character, '0' characters, digit characters for Value, and the Null-terminator
5150d1ba665SWarner Losh   add up to Width characters.
5160d1ba665SWarner Losh   If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
5170d1ba665SWarner Losh   If Buffer is NULL, then ASSERT().
5180d1ba665SWarner Losh   If Buffer is not aligned on a 16-bit boundary, then ASSERT().
5190d1ba665SWarner Losh   If unsupported bits are set in Flags, then ASSERT().
5200d1ba665SWarner Losh   If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
5210d1ba665SWarner Losh   If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
5220d1ba665SWarner Losh 
5230d1ba665SWarner Losh   @param  Buffer  The pointer to the output buffer for the produced Null-terminated
5240d1ba665SWarner Losh                   Unicode string.
5250d1ba665SWarner Losh   @param  Flags   The bitmask of flags that specify left justification, zero pad, and commas.
5260d1ba665SWarner Losh   @param  Value   The 64-bit signed value to convert to a string.
5270d1ba665SWarner Losh   @param  Width   The maximum number of Unicode characters to place in Buffer, not including
5280d1ba665SWarner Losh                   the Null-terminator.
5290d1ba665SWarner Losh 
5300d1ba665SWarner Losh   @return The number of Unicode characters in Buffer, not including the Null-terminator.
5310d1ba665SWarner Losh 
5320d1ba665SWarner Losh **/
5330d1ba665SWarner Losh UINTN
5340d1ba665SWarner Losh EFIAPI
5350d1ba665SWarner Losh UnicodeValueToString (
5360d1ba665SWarner Losh   IN OUT CHAR16  *Buffer,
5370d1ba665SWarner Losh   IN UINTN       Flags,
5380d1ba665SWarner Losh   IN INT64       Value,
5390d1ba665SWarner Losh   IN UINTN       Width
5400d1ba665SWarner Losh   );
5410d1ba665SWarner Losh 
5420d1ba665SWarner Losh #endif
5430d1ba665SWarner Losh 
5440d1ba665SWarner Losh /**
5450d1ba665SWarner Losh   Converts a decimal value to a Null-terminated Unicode string.
5460d1ba665SWarner Losh 
5470d1ba665SWarner Losh   Converts the decimal number specified by Value to a Null-terminated Unicode
5480d1ba665SWarner Losh   string specified by Buffer containing at most Width characters. No padding of
5490d1ba665SWarner Losh   spaces is ever performed. If Width is 0 then a width of
5500d1ba665SWarner Losh   MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than
5510d1ba665SWarner Losh   Width characters, then only the first Width characters are placed in Buffer.
5520d1ba665SWarner Losh   Additional conversion parameters are specified in Flags.
5530d1ba665SWarner Losh 
5540d1ba665SWarner Losh   The Flags bit LEFT_JUSTIFY is always ignored.
5550d1ba665SWarner Losh   All conversions are left justified in Buffer.
5560d1ba665SWarner Losh   If Width is 0, PREFIX_ZERO is ignored in Flags.
5570d1ba665SWarner Losh   If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and
5580d1ba665SWarner Losh   commas are inserted every 3rd digit starting from the right.
5590d1ba665SWarner Losh   If RADIX_HEX is set in Flags, then the output buffer will be formatted in
5600d1ba665SWarner Losh   hexadecimal format.
5610d1ba665SWarner Losh   If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in
5620d1ba665SWarner Losh   Buffer is a '-'.
5630d1ba665SWarner Losh   If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then
5640d1ba665SWarner Losh   Buffer is padded with '0' characters so the combination of the optional '-'
5650d1ba665SWarner Losh   sign character, '0' characters, digit characters for Value, and the
5660d1ba665SWarner Losh   Null-terminator add up to Width characters.
5670d1ba665SWarner Losh 
5680d1ba665SWarner Losh   If Buffer is not aligned on a 16-bit boundary, then ASSERT().
5690d1ba665SWarner Losh   If an error would be returned, then the function will also ASSERT().
5700d1ba665SWarner Losh 
5710d1ba665SWarner Losh   @param  Buffer      The pointer to the output buffer for the produced
5720d1ba665SWarner Losh                       Null-terminated Unicode string.
5730d1ba665SWarner Losh   @param  BufferSize  The size of Buffer in bytes, including the
5740d1ba665SWarner Losh                       Null-terminator.
5750d1ba665SWarner Losh   @param  Flags       The bitmask of flags that specify left justification,
5760d1ba665SWarner Losh                       zero pad, and commas.
5770d1ba665SWarner Losh   @param  Value       The 64-bit signed value to convert to a string.
5780d1ba665SWarner Losh   @param  Width       The maximum number of Unicode characters to place in
5790d1ba665SWarner Losh                       Buffer, not including the Null-terminator.
5800d1ba665SWarner Losh 
5810d1ba665SWarner Losh   @retval RETURN_SUCCESS           The decimal value is converted.
5820d1ba665SWarner Losh   @retval RETURN_BUFFER_TOO_SMALL  If BufferSize cannot hold the converted
5830d1ba665SWarner Losh                                    value.
5840d1ba665SWarner Losh   @retval RETURN_INVALID_PARAMETER If Buffer is NULL.
5850d1ba665SWarner Losh                                    If PcdMaximumUnicodeStringLength is not
5860d1ba665SWarner Losh                                    zero, and BufferSize is greater than
5870d1ba665SWarner Losh                                    (PcdMaximumUnicodeStringLength *
5880d1ba665SWarner Losh                                    sizeof (CHAR16) + 1).
5890d1ba665SWarner Losh                                    If unsupported bits are set in Flags.
5900d1ba665SWarner Losh                                    If both COMMA_TYPE and RADIX_HEX are set in
5910d1ba665SWarner Losh                                    Flags.
5920d1ba665SWarner Losh                                    If Width >= MAXIMUM_VALUE_CHARACTERS.
5930d1ba665SWarner Losh 
5940d1ba665SWarner Losh **/
5950d1ba665SWarner Losh RETURN_STATUS
5960d1ba665SWarner Losh EFIAPI
5970d1ba665SWarner Losh UnicodeValueToStringS (
5980d1ba665SWarner Losh   IN OUT CHAR16  *Buffer,
5990d1ba665SWarner Losh   IN UINTN       BufferSize,
6000d1ba665SWarner Losh   IN UINTN       Flags,
6010d1ba665SWarner Losh   IN INT64       Value,
6020d1ba665SWarner Losh   IN UINTN       Width
6030d1ba665SWarner Losh   );
6040d1ba665SWarner Losh 
6050d1ba665SWarner Losh /**
6060d1ba665SWarner Losh   Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
6070d1ba665SWarner Losh   ASCII format string and a VA_LIST argument list.
6080d1ba665SWarner Losh 
6090d1ba665SWarner Losh   This function is similar as vsnprintf_s defined in C11.
6100d1ba665SWarner Losh 
6110d1ba665SWarner Losh   Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
6120d1ba665SWarner Losh   and BufferSize.
6130d1ba665SWarner Losh   The ASCII string is produced by parsing the format string specified by FormatString.
6140d1ba665SWarner Losh   Arguments are pulled from the variable argument list specified by Marker based on
6150d1ba665SWarner Losh   the contents of the format string.
6160d1ba665SWarner Losh   The number of ASCII characters in the produced output buffer is returned not including
6170d1ba665SWarner Losh   the Null-terminator.
6180d1ba665SWarner Losh 
6190d1ba665SWarner Losh   If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
6200d1ba665SWarner Losh   unmodified and 0 is returned.
6210d1ba665SWarner Losh   If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
6220d1ba665SWarner Losh   unmodified and 0 is returned.
6230d1ba665SWarner Losh   If PcdMaximumAsciiStringLength is not zero, and BufferSize >
6240d1ba665SWarner Losh   (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
6250d1ba665SWarner Losh   is unmodified and 0 is returned.
6260d1ba665SWarner Losh   If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
6270d1ba665SWarner Losh   PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
6280d1ba665SWarner Losh   ASSERT(). Also, the output buffer is unmodified and 0 is returned.
6290d1ba665SWarner Losh 
6300d1ba665SWarner Losh   If BufferSize is 0, then no output buffer is produced and 0 is returned.
6310d1ba665SWarner Losh 
6320d1ba665SWarner Losh   @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
6330d1ba665SWarner Losh                           ASCII string.
6340d1ba665SWarner Losh   @param  BufferSize      The size, in bytes, of the output buffer specified by StartOfBuffer.
6350d1ba665SWarner Losh   @param  FormatString    A Null-terminated ASCII format string.
6360d1ba665SWarner Losh   @param  Marker          VA_LIST marker for the variable argument list.
6370d1ba665SWarner Losh 
6380d1ba665SWarner Losh   @return The number of ASCII characters in the produced output buffer not including the
6390d1ba665SWarner Losh           Null-terminator.
6400d1ba665SWarner Losh 
6410d1ba665SWarner Losh **/
6420d1ba665SWarner Losh UINTN
6430d1ba665SWarner Losh EFIAPI
6440d1ba665SWarner Losh AsciiVSPrint (
6450d1ba665SWarner Losh   OUT CHAR8         *StartOfBuffer,
6460d1ba665SWarner Losh   IN  UINTN         BufferSize,
6470d1ba665SWarner Losh   IN  CONST CHAR8   *FormatString,
6480d1ba665SWarner Losh   IN  VA_LIST       Marker
6490d1ba665SWarner Losh   );
6500d1ba665SWarner Losh 
6510d1ba665SWarner Losh /**
6520d1ba665SWarner Losh   Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
6530d1ba665SWarner Losh   ASCII format string and a BASE_LIST argument list.
6540d1ba665SWarner Losh 
6550d1ba665SWarner Losh   Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
6560d1ba665SWarner Losh   and BufferSize.
6570d1ba665SWarner Losh   The ASCII string is produced by parsing the format string specified by FormatString.
6580d1ba665SWarner Losh   Arguments are pulled from the variable argument list specified by Marker based on
6590d1ba665SWarner Losh   the contents of the format string.
6600d1ba665SWarner Losh   The number of ASCII characters in the produced output buffer is returned not including
6610d1ba665SWarner Losh   the Null-terminator.
6620d1ba665SWarner Losh 
6630d1ba665SWarner Losh   If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
6640d1ba665SWarner Losh   unmodified and 0 is returned.
6650d1ba665SWarner Losh   If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
6660d1ba665SWarner Losh   unmodified and 0 is returned.
6670d1ba665SWarner Losh   If PcdMaximumAsciiStringLength is not zero, and BufferSize >
6680d1ba665SWarner Losh   (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
6690d1ba665SWarner Losh   is unmodified and 0 is returned.
6700d1ba665SWarner Losh   If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
6710d1ba665SWarner Losh   PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
6720d1ba665SWarner Losh   ASSERT(). Also, the output buffer is unmodified and 0 is returned.
6730d1ba665SWarner Losh 
6740d1ba665SWarner Losh   If BufferSize is 0, then no output buffer is produced and 0 is returned.
6750d1ba665SWarner Losh 
6760d1ba665SWarner Losh   @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
6770d1ba665SWarner Losh                           ASCII string.
6780d1ba665SWarner Losh   @param  BufferSize      The size, in bytes, of the output buffer specified by StartOfBuffer.
6790d1ba665SWarner Losh   @param  FormatString    A Null-terminated ASCII format string.
6800d1ba665SWarner Losh   @param  Marker          BASE_LIST marker for the variable argument list.
6810d1ba665SWarner Losh 
6820d1ba665SWarner Losh   @return The number of ASCII characters in the produced output buffer not including the
6830d1ba665SWarner Losh           Null-terminator.
6840d1ba665SWarner Losh 
6850d1ba665SWarner Losh **/
6860d1ba665SWarner Losh UINTN
6870d1ba665SWarner Losh EFIAPI
6880d1ba665SWarner Losh AsciiBSPrint (
6890d1ba665SWarner Losh   OUT CHAR8         *StartOfBuffer,
6900d1ba665SWarner Losh   IN  UINTN         BufferSize,
6910d1ba665SWarner Losh   IN  CONST CHAR8   *FormatString,
6920d1ba665SWarner Losh   IN  BASE_LIST     Marker
6930d1ba665SWarner Losh   );
6940d1ba665SWarner Losh 
6950d1ba665SWarner Losh /**
6960d1ba665SWarner Losh   Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
6970d1ba665SWarner Losh   ASCII format string and  variable argument list.
6980d1ba665SWarner Losh 
6990d1ba665SWarner Losh   This function is similar as snprintf_s defined in C11.
7000d1ba665SWarner Losh 
7010d1ba665SWarner Losh   Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
7020d1ba665SWarner Losh   and BufferSize.
7030d1ba665SWarner Losh   The ASCII string is produced by parsing the format string specified by FormatString.
7040d1ba665SWarner Losh   Arguments are pulled from the variable argument list based on the contents of the
7050d1ba665SWarner Losh   format string.
7060d1ba665SWarner Losh   The number of ASCII characters in the produced output buffer is returned not including
7070d1ba665SWarner Losh   the Null-terminator.
7080d1ba665SWarner Losh 
7090d1ba665SWarner Losh   If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
7100d1ba665SWarner Losh   unmodified and 0 is returned.
7110d1ba665SWarner Losh   If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
7120d1ba665SWarner Losh   unmodified and 0 is returned.
7130d1ba665SWarner Losh   If PcdMaximumAsciiStringLength is not zero, and BufferSize >
7140d1ba665SWarner Losh   (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
7150d1ba665SWarner Losh   is unmodified and 0 is returned.
7160d1ba665SWarner Losh   If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
7170d1ba665SWarner Losh   PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
7180d1ba665SWarner Losh   ASSERT(). Also, the output buffer is unmodified and 0 is returned.
7190d1ba665SWarner Losh 
7200d1ba665SWarner Losh   If BufferSize is 0, then no output buffer is produced and 0 is returned.
7210d1ba665SWarner Losh 
7220d1ba665SWarner Losh   @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
7230d1ba665SWarner Losh                           ASCII string.
7240d1ba665SWarner Losh   @param  BufferSize      The size, in bytes, of the output buffer specified by StartOfBuffer.
7250d1ba665SWarner Losh   @param  FormatString    A Null-terminated ASCII format string.
7260d1ba665SWarner Losh   @param  ...             Variable argument list whose contents are accessed based on the
7270d1ba665SWarner Losh                           format string specified by FormatString.
7280d1ba665SWarner Losh 
7290d1ba665SWarner Losh   @return The number of ASCII characters in the produced output buffer not including the
7300d1ba665SWarner Losh           Null-terminator.
7310d1ba665SWarner Losh 
7320d1ba665SWarner Losh **/
7330d1ba665SWarner Losh UINTN
7340d1ba665SWarner Losh EFIAPI
7350d1ba665SWarner Losh AsciiSPrint (
7360d1ba665SWarner Losh   OUT CHAR8        *StartOfBuffer,
7370d1ba665SWarner Losh   IN  UINTN        BufferSize,
7380d1ba665SWarner Losh   IN  CONST CHAR8  *FormatString,
7390d1ba665SWarner Losh   ...
7400d1ba665SWarner Losh   );
7410d1ba665SWarner Losh 
7420d1ba665SWarner Losh /**
7430d1ba665SWarner Losh   Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
7440d1ba665SWarner Losh   Unicode format string and a VA_LIST argument list.
7450d1ba665SWarner Losh 
7460d1ba665SWarner Losh   This function is similar as vsnprintf_s defined in C11.
7470d1ba665SWarner Losh 
7480d1ba665SWarner Losh   Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
7490d1ba665SWarner Losh   and BufferSize.
7500d1ba665SWarner Losh   The ASCII string is produced by parsing the format string specified by FormatString.
7510d1ba665SWarner Losh   Arguments are pulled from the variable argument list specified by Marker based on
7520d1ba665SWarner Losh   the contents of the format string.
7530d1ba665SWarner Losh   The number of ASCII characters in the produced output buffer is returned not including
7540d1ba665SWarner Losh   the Null-terminator.
7550d1ba665SWarner Losh 
7560d1ba665SWarner Losh   If FormatString is not aligned on a 16-bit boundary, then ASSERT().
7570d1ba665SWarner Losh 
7580d1ba665SWarner Losh   If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
7590d1ba665SWarner Losh   unmodified and 0 is returned.
7600d1ba665SWarner Losh   If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
7610d1ba665SWarner Losh   unmodified and 0 is returned.
7620d1ba665SWarner Losh   If PcdMaximumAsciiStringLength is not zero, and BufferSize >
7630d1ba665SWarner Losh   (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
7640d1ba665SWarner Losh   is unmodified and 0 is returned.
7650d1ba665SWarner Losh   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
7660d1ba665SWarner Losh   PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
7670d1ba665SWarner Losh   ASSERT(). Also, the output buffer is unmodified and 0 is returned.
7680d1ba665SWarner Losh 
7690d1ba665SWarner Losh   If BufferSize is 0, then no output buffer is produced and 0 is returned.
7700d1ba665SWarner Losh 
7710d1ba665SWarner Losh   @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
7720d1ba665SWarner Losh                           ASCII string.
7730d1ba665SWarner Losh   @param  BufferSize      The size, in bytes, of the output buffer specified by StartOfBuffer.
7740d1ba665SWarner Losh   @param  FormatString    A Null-terminated Unicode format string.
7750d1ba665SWarner Losh   @param  Marker          VA_LIST marker for the variable argument list.
7760d1ba665SWarner Losh 
7770d1ba665SWarner Losh   @return The number of ASCII characters in the produced output buffer not including the
7780d1ba665SWarner Losh           Null-terminator.
7790d1ba665SWarner Losh 
7800d1ba665SWarner Losh **/
7810d1ba665SWarner Losh UINTN
7820d1ba665SWarner Losh EFIAPI
7830d1ba665SWarner Losh AsciiVSPrintUnicodeFormat (
7840d1ba665SWarner Losh   OUT CHAR8         *StartOfBuffer,
7850d1ba665SWarner Losh   IN  UINTN         BufferSize,
7860d1ba665SWarner Losh   IN  CONST CHAR16  *FormatString,
7870d1ba665SWarner Losh   IN  VA_LIST       Marker
7880d1ba665SWarner Losh   );
7890d1ba665SWarner Losh 
7900d1ba665SWarner Losh /**
7910d1ba665SWarner Losh   Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
7920d1ba665SWarner Losh   Unicode format string and a BASE_LIST argument list.
7930d1ba665SWarner Losh 
7940d1ba665SWarner Losh   Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
7950d1ba665SWarner Losh   and BufferSize.
7960d1ba665SWarner Losh   The ASCII string is produced by parsing the format string specified by FormatString.
7970d1ba665SWarner Losh   Arguments are pulled from the variable argument list specified by Marker based on
7980d1ba665SWarner Losh   the contents of the format string.
7990d1ba665SWarner Losh   The number of ASCII characters in the produced output buffer is returned not including
8000d1ba665SWarner Losh   the Null-terminator.
8010d1ba665SWarner Losh 
8020d1ba665SWarner Losh   If FormatString is not aligned on a 16-bit boundary, then ASSERT().
8030d1ba665SWarner Losh 
8040d1ba665SWarner Losh   If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
8050d1ba665SWarner Losh   unmodified and 0 is returned.
8060d1ba665SWarner Losh   If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
8070d1ba665SWarner Losh   unmodified and 0 is returned.
8080d1ba665SWarner Losh   If PcdMaximumAsciiStringLength is not zero, and BufferSize >
8090d1ba665SWarner Losh   (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
8100d1ba665SWarner Losh   is unmodified and 0 is returned.
8110d1ba665SWarner Losh   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
8120d1ba665SWarner Losh   PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
8130d1ba665SWarner Losh   ASSERT(). Also, the output buffer is unmodified and 0 is returned.
8140d1ba665SWarner Losh 
8150d1ba665SWarner Losh   If BufferSize is 0, then no output buffer is produced and 0 is returned.
8160d1ba665SWarner Losh 
8170d1ba665SWarner Losh   @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
8180d1ba665SWarner Losh                           ASCII string.
8190d1ba665SWarner Losh   @param  BufferSize      The size, in bytes, of the output buffer specified by StartOfBuffer.
8200d1ba665SWarner Losh   @param  FormatString    A Null-terminated Unicode format string.
8210d1ba665SWarner Losh   @param  Marker          BASE_LIST marker for the variable argument list.
8220d1ba665SWarner Losh 
8230d1ba665SWarner Losh   @return The number of ASCII characters in the produced output buffer not including the
8240d1ba665SWarner Losh           Null-terminator.
8250d1ba665SWarner Losh 
8260d1ba665SWarner Losh **/
8270d1ba665SWarner Losh UINTN
8280d1ba665SWarner Losh EFIAPI
8290d1ba665SWarner Losh AsciiBSPrintUnicodeFormat (
8300d1ba665SWarner Losh   OUT CHAR8         *StartOfBuffer,
8310d1ba665SWarner Losh   IN  UINTN         BufferSize,
8320d1ba665SWarner Losh   IN  CONST CHAR16  *FormatString,
8330d1ba665SWarner Losh   IN  BASE_LIST     Marker
8340d1ba665SWarner Losh   );
8350d1ba665SWarner Losh 
8360d1ba665SWarner Losh /**
8370d1ba665SWarner Losh   Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
8380d1ba665SWarner Losh   Unicode format string and  variable argument list.
8390d1ba665SWarner Losh 
8400d1ba665SWarner Losh   This function is similar as snprintf_s defined in C11.
8410d1ba665SWarner Losh 
8420d1ba665SWarner Losh   Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
8430d1ba665SWarner Losh   and BufferSize.
8440d1ba665SWarner Losh   The ASCII string is produced by parsing the format string specified by FormatString.
8450d1ba665SWarner Losh   Arguments are pulled from the variable argument list based on the contents of the
8460d1ba665SWarner Losh   format string.
8470d1ba665SWarner Losh   The number of ASCII characters in the produced output buffer is returned not including
8480d1ba665SWarner Losh   the Null-terminator.
8490d1ba665SWarner Losh 
8500d1ba665SWarner Losh   If FormatString is not aligned on a 16-bit boundary, then ASSERT().
8510d1ba665SWarner Losh 
8520d1ba665SWarner Losh   If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
8530d1ba665SWarner Losh   unmodified and 0 is returned.
8540d1ba665SWarner Losh   If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
8550d1ba665SWarner Losh   unmodified and 0 is returned.
8560d1ba665SWarner Losh   If PcdMaximumAsciiStringLength is not zero, and BufferSize >
8570d1ba665SWarner Losh   (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
8580d1ba665SWarner Losh   is unmodified and 0 is returned.
8590d1ba665SWarner Losh   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
8600d1ba665SWarner Losh   PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
8610d1ba665SWarner Losh   ASSERT(). Also, the output buffer is unmodified and 0 is returned.
8620d1ba665SWarner Losh 
8630d1ba665SWarner Losh   If BufferSize is 0, then no output buffer is produced and 0 is returned.
8640d1ba665SWarner Losh 
8650d1ba665SWarner Losh   @param  StartOfBuffer   A pointer to the output buffer for the produced Null-terminated
8660d1ba665SWarner Losh                           ASCII string.
8670d1ba665SWarner Losh   @param  BufferSize      The size, in bytes, of the output buffer specified by StartOfBuffer.
8680d1ba665SWarner Losh   @param  FormatString    A Null-terminated Unicode format string.
8690d1ba665SWarner Losh   @param  ...             Variable argument list whose contents are accessed based on the
8700d1ba665SWarner Losh                           format string specified by FormatString.
8710d1ba665SWarner Losh 
8720d1ba665SWarner Losh   @return The number of ASCII characters in the produced output buffer not including the
8730d1ba665SWarner Losh           Null-terminator.
8740d1ba665SWarner Losh 
8750d1ba665SWarner Losh **/
8760d1ba665SWarner Losh UINTN
8770d1ba665SWarner Losh EFIAPI
8780d1ba665SWarner Losh AsciiSPrintUnicodeFormat (
8790d1ba665SWarner Losh   OUT CHAR8         *StartOfBuffer,
8800d1ba665SWarner Losh   IN  UINTN         BufferSize,
8810d1ba665SWarner Losh   IN  CONST CHAR16  *FormatString,
8820d1ba665SWarner Losh   ...
8830d1ba665SWarner Losh   );
8840d1ba665SWarner Losh 
8850d1ba665SWarner Losh #ifndef DISABLE_NEW_DEPRECATED_INTERFACES
8860d1ba665SWarner Losh 
8870d1ba665SWarner Losh /**
8880d1ba665SWarner Losh   [ATTENTION] This function is deprecated for security reason.
8890d1ba665SWarner Losh 
8900d1ba665SWarner Losh   Converts a decimal value to a Null-terminated ASCII string.
8910d1ba665SWarner Losh 
8920d1ba665SWarner Losh   Converts the decimal number specified by Value to a Null-terminated ASCII string
8930d1ba665SWarner Losh   specified by Buffer containing at most Width characters. No padding of spaces
8940d1ba665SWarner Losh   is ever performed.
8950d1ba665SWarner Losh   If Width is 0 then a width of  MAXIMUM_VALUE_CHARACTERS is assumed.
8960d1ba665SWarner Losh   The number of ASCII characters in Buffer is returned, not including the Null-terminator.
8970d1ba665SWarner Losh   If the conversion contains more than Width characters, then only the first Width
8980d1ba665SWarner Losh   characters are returned, and the total number of characters required to perform
8990d1ba665SWarner Losh   the conversion is returned.
9000d1ba665SWarner Losh   Additional conversion parameters are specified in Flags.
9010d1ba665SWarner Losh   The Flags bit LEFT_JUSTIFY is always ignored.
9020d1ba665SWarner Losh   All conversions are left justified in Buffer.
9030d1ba665SWarner Losh   If Width is 0, PREFIX_ZERO is ignored in Flags.
9040d1ba665SWarner Losh   If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
9050d1ba665SWarner Losh   are inserted every 3rd digit starting from the right.
9060d1ba665SWarner Losh   If RADIX_HEX is set in Flags, then the output buffer will be
9070d1ba665SWarner Losh   formatted in hexadecimal format.
9080d1ba665SWarner Losh   If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
9090d1ba665SWarner Losh   If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
9100d1ba665SWarner Losh   then Buffer is padded with '0' characters so the combination of the optional '-'
9110d1ba665SWarner Losh   sign character, '0' characters, digit characters for Value, and the Null-terminator
9120d1ba665SWarner Losh   add up to Width characters.
9130d1ba665SWarner Losh 
9140d1ba665SWarner Losh   If Buffer is NULL, then ASSERT().
9150d1ba665SWarner Losh   If unsupported bits are set in Flags, then ASSERT().
9160d1ba665SWarner Losh   If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
9170d1ba665SWarner Losh   If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
9180d1ba665SWarner Losh 
9190d1ba665SWarner Losh   @param  Buffer  A pointer to the output buffer for the produced Null-terminated
9200d1ba665SWarner Losh                   ASCII string.
9210d1ba665SWarner Losh   @param  Flags   The bitmask of flags that specify left justification, zero pad, and commas.
9220d1ba665SWarner Losh   @param  Value   The 64-bit signed value to convert to a string.
9230d1ba665SWarner Losh   @param  Width   The maximum number of ASCII characters to place in Buffer, not including
9240d1ba665SWarner Losh                   the Null-terminator.
9250d1ba665SWarner Losh 
9260d1ba665SWarner Losh   @return The number of ASCII characters in Buffer, not including the Null-terminator.
9270d1ba665SWarner Losh 
9280d1ba665SWarner Losh **/
9290d1ba665SWarner Losh UINTN
9300d1ba665SWarner Losh EFIAPI
9310d1ba665SWarner Losh AsciiValueToString (
9320d1ba665SWarner Losh   OUT CHAR8      *Buffer,
9330d1ba665SWarner Losh   IN  UINTN      Flags,
9340d1ba665SWarner Losh   IN  INT64      Value,
9350d1ba665SWarner Losh   IN  UINTN      Width
9360d1ba665SWarner Losh   );
9370d1ba665SWarner Losh 
9380d1ba665SWarner Losh #endif
9390d1ba665SWarner Losh 
9400d1ba665SWarner Losh /**
9410d1ba665SWarner Losh   Converts a decimal value to a Null-terminated Ascii string.
9420d1ba665SWarner Losh 
9430d1ba665SWarner Losh   Converts the decimal number specified by Value to a Null-terminated Ascii
9440d1ba665SWarner Losh   string specified by Buffer containing at most Width characters. No padding of
9450d1ba665SWarner Losh   spaces is ever performed. If Width is 0 then a width of
9460d1ba665SWarner Losh   MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than
9470d1ba665SWarner Losh   Width characters, then only the first Width characters are placed in Buffer.
9480d1ba665SWarner Losh   Additional conversion parameters are specified in Flags.
9490d1ba665SWarner Losh 
9500d1ba665SWarner Losh   The Flags bit LEFT_JUSTIFY is always ignored.
9510d1ba665SWarner Losh   All conversions are left justified in Buffer.
9520d1ba665SWarner Losh   If Width is 0, PREFIX_ZERO is ignored in Flags.
9530d1ba665SWarner Losh   If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and
9540d1ba665SWarner Losh   commas are inserted every 3rd digit starting from the right.
9550d1ba665SWarner Losh   If RADIX_HEX is set in Flags, then the output buffer will be formatted in
9560d1ba665SWarner Losh   hexadecimal format.
9570d1ba665SWarner Losh   If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in
9580d1ba665SWarner Losh   Buffer is a '-'.
9590d1ba665SWarner Losh   If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then
9600d1ba665SWarner Losh   Buffer is padded with '0' characters so the combination of the optional '-'
9610d1ba665SWarner Losh   sign character, '0' characters, digit characters for Value, and the
9620d1ba665SWarner Losh   Null-terminator add up to Width characters.
9630d1ba665SWarner Losh 
964*3245fa21SMitchell Horne   If an error would be returned, then the function will ASSERT().
9650d1ba665SWarner Losh 
9660d1ba665SWarner Losh   @param  Buffer      The pointer to the output buffer for the produced
9670d1ba665SWarner Losh                       Null-terminated Ascii string.
9680d1ba665SWarner Losh   @param  BufferSize  The size of Buffer in bytes, including the
9690d1ba665SWarner Losh                       Null-terminator.
9700d1ba665SWarner Losh   @param  Flags       The bitmask of flags that specify left justification,
9710d1ba665SWarner Losh                       zero pad, and commas.
9720d1ba665SWarner Losh   @param  Value       The 64-bit signed value to convert to a string.
9730d1ba665SWarner Losh   @param  Width       The maximum number of Ascii characters to place in
9740d1ba665SWarner Losh                       Buffer, not including the Null-terminator.
9750d1ba665SWarner Losh 
9760d1ba665SWarner Losh   @retval RETURN_SUCCESS           The decimal value is converted.
9770d1ba665SWarner Losh   @retval RETURN_BUFFER_TOO_SMALL  If BufferSize cannot hold the converted
9780d1ba665SWarner Losh                                    value.
9790d1ba665SWarner Losh   @retval RETURN_INVALID_PARAMETER If Buffer is NULL.
9800d1ba665SWarner Losh                                    If PcdMaximumAsciiStringLength is not
9810d1ba665SWarner Losh                                    zero, and BufferSize is greater than
9820d1ba665SWarner Losh                                    PcdMaximumAsciiStringLength.
9830d1ba665SWarner Losh                                    If unsupported bits are set in Flags.
9840d1ba665SWarner Losh                                    If both COMMA_TYPE and RADIX_HEX are set in
9850d1ba665SWarner Losh                                    Flags.
9860d1ba665SWarner Losh                                    If Width >= MAXIMUM_VALUE_CHARACTERS.
9870d1ba665SWarner Losh 
9880d1ba665SWarner Losh **/
9890d1ba665SWarner Losh RETURN_STATUS
9900d1ba665SWarner Losh EFIAPI
9910d1ba665SWarner Losh AsciiValueToStringS (
9920d1ba665SWarner Losh   IN OUT CHAR8   *Buffer,
9930d1ba665SWarner Losh   IN UINTN       BufferSize,
9940d1ba665SWarner Losh   IN UINTN       Flags,
9950d1ba665SWarner Losh   IN INT64       Value,
9960d1ba665SWarner Losh   IN UINTN       Width
9970d1ba665SWarner Losh   );
9980d1ba665SWarner Losh 
9990d1ba665SWarner Losh /**
10000d1ba665SWarner Losh   Returns the number of characters that would be produced by if the formatted
10010d1ba665SWarner Losh   output were produced not including the Null-terminator.
10020d1ba665SWarner Losh 
10030d1ba665SWarner Losh   If FormatString is not aligned on a 16-bit boundary, then ASSERT().
10040d1ba665SWarner Losh 
10050d1ba665SWarner Losh   If FormatString is NULL, then ASSERT() and 0 is returned.
10060d1ba665SWarner Losh   If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more
10070d1ba665SWarner Losh   than PcdMaximumUnicodeStringLength Unicode characters not including the
10080d1ba665SWarner Losh   Null-terminator, then ASSERT() and 0 is returned.
10090d1ba665SWarner Losh 
10100d1ba665SWarner Losh   @param[in]  FormatString    A Null-terminated Unicode format string.
10110d1ba665SWarner Losh   @param[in]  Marker          VA_LIST marker for the variable argument list.
10120d1ba665SWarner Losh 
10130d1ba665SWarner Losh   @return The number of characters that would be produced, not including the
10140d1ba665SWarner Losh           Null-terminator.
10150d1ba665SWarner Losh **/
10160d1ba665SWarner Losh UINTN
10170d1ba665SWarner Losh EFIAPI
10180d1ba665SWarner Losh SPrintLength (
10190d1ba665SWarner Losh   IN  CONST CHAR16   *FormatString,
10200d1ba665SWarner Losh   IN  VA_LIST       Marker
10210d1ba665SWarner Losh   );
10220d1ba665SWarner Losh 
10230d1ba665SWarner Losh /**
10240d1ba665SWarner Losh   Returns the number of characters that would be produced by if the formatted
10250d1ba665SWarner Losh   output were produced not including the Null-terminator.
10260d1ba665SWarner Losh 
10270d1ba665SWarner Losh   If FormatString is NULL, then ASSERT() and 0 is returned.
10280d1ba665SWarner Losh   If PcdMaximumAsciiStringLength is not zero, and FormatString contains more
10290d1ba665SWarner Losh   than PcdMaximumAsciiStringLength Ascii characters not including the
10300d1ba665SWarner Losh   Null-terminator, then ASSERT() and 0 is returned.
10310d1ba665SWarner Losh 
10320d1ba665SWarner Losh   @param[in]  FormatString    A Null-terminated ASCII format string.
10330d1ba665SWarner Losh   @param[in]  Marker          VA_LIST marker for the variable argument list.
10340d1ba665SWarner Losh 
10350d1ba665SWarner Losh   @return The number of characters that would be produced, not including the
10360d1ba665SWarner Losh           Null-terminator.
10370d1ba665SWarner Losh **/
10380d1ba665SWarner Losh UINTN
10390d1ba665SWarner Losh EFIAPI
10400d1ba665SWarner Losh SPrintLengthAsciiFormat (
10410d1ba665SWarner Losh   IN  CONST CHAR8   *FormatString,
10420d1ba665SWarner Losh   IN  VA_LIST       Marker
10430d1ba665SWarner Losh   );
10440d1ba665SWarner Losh 
10450d1ba665SWarner Losh #endif
1046