Path: blob/main/sys/contrib/edk2/Include/Library/PrintLib.h
48383 views
/** @file1Provides services to print a formatted string to a buffer. All combinations of2Unicode and ASCII strings are supported.34Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>5SPDX-License-Identifier: BSD-2-Clause-Patent67The Print Library functions provide a simple means to produce formatted output8strings. Many of the output functions use a format string to describe how to9format the output of variable arguments. The format string consists of normal10text and argument descriptors. There are no restrictions for how the normal11text and argument descriptors can be mixed. The following end of line(EOL)12translations must be performed on the contents of the format string:1314- '\\r' is translated to '\\r'15- '\\r\\n' is translated to '\\r\\n'16- '\\n' is translated to '\\r\\n'17- '\\n\\r' is translated to '\\r\\n'1819This does not follow the ANSI C standard for sprint(). The format of argument20descriptors is described below. The ANSI C standard for sprint() has been21followed for some of the format types, and has not been followed for others.22The exceptions are noted below.2324%[flags][width][.precision]type2526[flags]:27- -28- The field is left justified. If not flag is not specified, then the29field is right justified.30- space31- Prefix a space character to a number. Only valid for types X, x, and d.32- +33- Prefix a plus character to a number. Only valid for types X, x, and d.34If both space and + are specified, then space is ignored.35- 036- Pad with 0 characters to the left of a number. Only valid for types37X, x, and d.38- ,39- Place a comma every 3rd digit of the number. Only valid for type d.40If 0 is also specified, then 0 is ignored.41- L, l42- The number being printed is size UINT64. Only valid for types X, x, and d.43If this flag is not specified, then the number being printed is size int.44- NOTE: All invalid flags are ignored.4546[width]:4748- *49- The width of the field is specified by a UINTN argument in the50argument list.51- number52- The number specified as a decimal value represents the width of53the field.54- NOTE: If [width] is not specified, then a field width of 0 is assumed.5556[.precision]:5758- *59- The precision of the field is specified by a UINTN argument in the60argument list.61- number62- The number specified as a decimal value represents the precision of63the field.64- NOTE: If [.precision] is not specified, then a precision of 0 is assumed.6566type:6768- %69- Print a %%.70- c71- The argument is a Unicode character. ASCII characters can be printed72using this type too by making sure bits 8..15 of the argument are set to 0.73- x74- The argument is an unsigned hexadecimal number. The characters used are 0..9 and75A..F. If the flag 'L' is not specified, then the argument is assumed76to be size int. This does not follow ANSI C.77- X78- The argument is an unsigned hexadecimal number and the number is padded with79zeros. This is equivalent to a format string of "0x". If the flag80'L' is not specified, then the argument is assumed to be size int.81This does not follow ANSI C.82- d83- The argument is a signed decimal number. If the flag 'L' is not specified,84then the argument is assumed to be size int.85- u86- The argument is a unsigned decimal number. If the flag 'L' is not specified,87then the argument is assumed to be size int.88- p89- The argument is a pointer that is a (VOID *), and it is printed as an90unsigned hexadecimal number The characters used are 0..9 and A..F.91- a92- The argument is a pointer to an ASCII string.93This does not follow ANSI C.94- S, s95- The argument is a pointer to a Unicode string.96This does not follow ANSI C.97- g98- The argument is a pointer to a GUID structure. The GUID is printed99in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.100This does not follow ANSI C.101- t102- The argument is a pointer to an EFI_TIME structure. The time and103date are printed in the format "mm/dd/yyyy hh:mm" where mm is the104month zero padded, dd is the day zero padded, yyyy is the year zero105padded, hh is the hour zero padded, and mm is minutes zero padded.106This does not follow ANSI C.107- r108- The argument is a RETURN_STATUS value. This value is converted to109a string following the table below. This does not follow ANSI C.110- RETURN_SUCCESS111- "Success"112- RETURN_LOAD_ERROR113- "Load Error"114- RETURN_INVALID_PARAMETER115- "Invalid Parameter"116- RETURN_UNSUPPORTED117- "Unsupported"118- RETURN_BAD_BUFFER_SIZE119- "Bad Buffer Size"120- RETURN_BUFFER_TOO_SMALL121- "Buffer Too Small"122- RETURN_NOT_READY123- "Not Ready"124- RETURN_DEVICE_ERROR125- "Device Error"126- RETURN_WRITE_PROTECTED127- "Write Protected"128- RETURN_OUT_OF_RESOURCES129- "Out of Resources"130- RETURN_VOLUME_CORRUPTED131- "Volume Corrupt"132- RETURN_VOLUME_FULL133- "Volume Full"134- RETURN_NO_MEDIA135- "No Media"136- RETURN_MEDIA_CHANGED137- "Media changed"138- RETURN_NOT_FOUND139- "Not Found"140- RETURN_ACCESS_DENIED141- "Access Denied"142- RETURN_NO_RESPONSE143- "No Response"144- RETURN_NO_MAPPING145- "No mapping"146- RETURN_TIMEOUT147- "Time out"148- RETURN_NOT_STARTED149- "Not started"150- RETURN_ALREADY_STARTED151- "Already started"152- RETURN_ABORTED153- "Aborted"154- RETURN_ICMP_ERROR155- "ICMP Error"156- RETURN_TFTP_ERROR157- "TFTP Error"158- RETURN_PROTOCOL_ERROR159- "Protocol Error"160- RETURN_WARN_UNKNOWN_GLYPH161- "Warning Unknown Glyph"162- RETURN_WARN_DELETE_FAILURE163- "Warning Delete Failure"164- RETURN_WARN_WRITE_FAILURE165- "Warning Write Failure"166- RETURN_WARN_BUFFER_TOO_SMALL167- "Warning Buffer Too Small"168169**/170171#ifndef __PRINT_LIB_H__172#define __PRINT_LIB_H__173174///175/// Define the maximum number of characters that are required to176/// encode with a NULL terminator a decimal, hexadecimal, GUID,177/// or TIME value.178///179/// Maximum Length Decimal String = 28180/// "-9,223,372,036,854,775,808"181/// Maximum Length Hexadecimal String = 17182/// "FFFFFFFFFFFFFFFF"183/// Maximum Length GUID = 37184/// "00000000-0000-0000-0000-000000000000"185/// Maximum Length TIME = 18186/// "12/12/2006 12:12"187///188#define MAXIMUM_VALUE_CHARACTERS 38189190///191/// Flags bitmask values use in UnicodeValueToString() and192/// AsciiValueToString()193///194#define LEFT_JUSTIFY 0x01195#define COMMA_TYPE 0x08196#define PREFIX_ZERO 0x20197#define RADIX_HEX 0x80198199/**200Produces a Null-terminated Unicode string in an output buffer based on201a Null-terminated Unicode format string and a VA_LIST argument list.202203This function is similar as vsnprintf_s defined in C11.204205Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer206and BufferSize.207The Unicode string is produced by parsing the format string specified by FormatString.208Arguments are pulled from the variable argument list specified by Marker based on the209contents of the format string.210The number of Unicode characters in the produced output buffer is returned not including211the Null-terminator.212213If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().214If FormatString is not aligned on a 16-bit boundary, then ASSERT().215216If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is217unmodified and 0 is returned.218If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is219unmodified and 0 is returned.220If PcdMaximumUnicodeStringLength is not zero, and BufferSize >221(PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output222buffer is unmodified and 0 is returned.223If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than224PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then225ASSERT(). Also, the output buffer is unmodified and 0 is returned.226227If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.228229@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated230Unicode string.231@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.232@param FormatString A Null-terminated Unicode format string.233@param Marker VA_LIST marker for the variable argument list.234235@return The number of Unicode characters in the produced output buffer not including the236Null-terminator.237238**/239UINTN240EFIAPI241UnicodeVSPrint (242OUT CHAR16 *StartOfBuffer,243IN UINTN BufferSize,244IN CONST CHAR16 *FormatString,245IN VA_LIST Marker246);247248/**249Produces a Null-terminated Unicode string in an output buffer based on250a Null-terminated Unicode format string and a BASE_LIST argument list.251252Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer253and BufferSize.254The Unicode string is produced by parsing the format string specified by FormatString.255Arguments are pulled from the variable argument list specified by Marker based on the256contents of the format string.257The number of Unicode characters in the produced output buffer is returned not including258the Null-terminator.259260If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().261If FormatString is not aligned on a 16-bit boundary, then ASSERT().262263If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is264unmodified and 0 is returned.265If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is266unmodified and 0 is returned.267If PcdMaximumUnicodeStringLength is not zero, and BufferSize >268(PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output269buffer is unmodified and 0 is returned.270If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than271PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then272ASSERT(). Also, the output buffer is unmodified and 0 is returned.273274If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.275276@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated277Unicode string.278@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.279@param FormatString A Null-terminated Unicode format string.280@param Marker BASE_LIST marker for the variable argument list.281282@return The number of Unicode characters in the produced output buffer not including the283Null-terminator.284285**/286UINTN287EFIAPI288UnicodeBSPrint (289OUT CHAR16 *StartOfBuffer,290IN UINTN BufferSize,291IN CONST CHAR16 *FormatString,292IN BASE_LIST Marker293);294295/**296Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated297Unicode format string and variable argument list.298299This function is similar as snprintf_s defined in C11.300301Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer302and BufferSize.303The Unicode string is produced by parsing the format string specified by FormatString.304Arguments are pulled from the variable argument list based on the contents of the format string.305The number of Unicode characters in the produced output buffer is returned not including306the Null-terminator.307308If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().309If FormatString is not aligned on a 16-bit boundary, then ASSERT().310311If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is312unmodified and 0 is returned.313If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is314unmodified and 0 is returned.315If PcdMaximumUnicodeStringLength is not zero, and BufferSize >316(PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output317buffer is unmodified and 0 is returned.318If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than319PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then320ASSERT(). Also, the output buffer is unmodified and 0 is returned.321322If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.323324@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated325Unicode string.326@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.327@param FormatString A Null-terminated Unicode format string.328@param ... Variable argument list whose contents are accessed based on the329format string specified by FormatString.330331@return The number of Unicode characters in the produced output buffer not including the332Null-terminator.333334**/335UINTN336EFIAPI337UnicodeSPrint (338OUT CHAR16 *StartOfBuffer,339IN UINTN BufferSize,340IN CONST CHAR16 *FormatString,341...342);343344/**345Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated346ASCII format string and a VA_LIST argument list.347348This function is similar as vsnprintf_s defined in C11.349350Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer351and BufferSize.352The Unicode string is produced by parsing the format string specified by FormatString.353Arguments are pulled from the variable argument list specified by Marker based on the354contents of the format string.355The number of Unicode characters in the produced output buffer is returned not including356the Null-terminator.357358If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().359360If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is361unmodified and 0 is returned.362If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is363unmodified and 0 is returned.364If PcdMaximumUnicodeStringLength is not zero, and BufferSize >365(PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output366buffer is unmodified and 0 is returned.367If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than368PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then369ASSERT(). Also, the output buffer is unmodified and 0 is returned.370371If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.372373@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated374Unicode string.375@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.376@param FormatString A Null-terminated ASCII format string.377@param Marker VA_LIST marker for the variable argument list.378379@return The number of Unicode characters in the produced output buffer not including the380Null-terminator.381382**/383UINTN384EFIAPI385UnicodeVSPrintAsciiFormat (386OUT CHAR16 *StartOfBuffer,387IN UINTN BufferSize,388IN CONST CHAR8 *FormatString,389IN VA_LIST Marker390);391392/**393Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated394ASCII format string and a BASE_LIST argument list.395396Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer397and BufferSize.398The Unicode string is produced by parsing the format string specified by FormatString.399Arguments are pulled from the variable argument list specified by Marker based on the400contents of the format string.401The number of Unicode characters in the produced output buffer is returned not including402the Null-terminator.403404If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().405406If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is407unmodified and 0 is returned.408If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is409unmodified and 0 is returned.410If PcdMaximumUnicodeStringLength is not zero, and BufferSize >411(PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output412buffer is unmodified and 0 is returned.413If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than414PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then415ASSERT(). Also, the output buffer is unmodified and 0 is returned.416417If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.418419@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated420Unicode string.421@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.422@param FormatString A Null-terminated ASCII format string.423@param Marker BASE_LIST marker for the variable argument list.424425@return The number of Unicode characters in the produced output buffer not including the426Null-terminator.427428**/429UINTN430EFIAPI431UnicodeBSPrintAsciiFormat (432OUT CHAR16 *StartOfBuffer,433IN UINTN BufferSize,434IN CONST CHAR8 *FormatString,435IN BASE_LIST Marker436);437438/**439Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated440ASCII format string and variable argument list.441442This function is similar as snprintf_s defined in C11.443444Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer445and BufferSize.446The Unicode string is produced by parsing the format string specified by FormatString.447Arguments are pulled from the variable argument list based on the contents of the448format string.449The number of Unicode characters in the produced output buffer is returned not including450the Null-terminator.451452If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().453454If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is455unmodified and 0 is returned.456If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is457unmodified and 0 is returned.458If PcdMaximumUnicodeStringLength is not zero, and BufferSize >459(PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output460buffer is unmodified and 0 is returned.461If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than462PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then463ASSERT(). Also, the output buffer is unmodified and 0 is returned.464465If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.466467@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated468Unicode string.469@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.470@param FormatString A Null-terminated ASCII format string.471@param ... Variable argument list whose contents are accessed based on the472format string specified by FormatString.473474@return The number of Unicode characters in the produced output buffer not including the475Null-terminator.476477**/478UINTN479EFIAPI480UnicodeSPrintAsciiFormat (481OUT CHAR16 *StartOfBuffer,482IN UINTN BufferSize,483IN CONST CHAR8 *FormatString,484...485);486487/**488Converts a decimal value to a Null-terminated Unicode string.489490Converts the decimal number specified by Value to a Null-terminated Unicode491string specified by Buffer containing at most Width characters. No padding of492spaces is ever performed. If Width is 0 then a width of493MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than494Width characters, then only the first Width characters are placed in Buffer.495Additional conversion parameters are specified in Flags.496497The Flags bit LEFT_JUSTIFY is always ignored.498All conversions are left justified in Buffer.499If Width is 0, PREFIX_ZERO is ignored in Flags.500If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and501commas are inserted every 3rd digit starting from the right.502If RADIX_HEX is set in Flags, then the output buffer will be formatted in503hexadecimal format.504If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in505Buffer is a '-'.506If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then507Buffer is padded with '0' characters so the combination of the optional '-'508sign character, '0' characters, digit characters for Value, and the509Null-terminator add up to Width characters.510511If Buffer is not aligned on a 16-bit boundary, then ASSERT().512If an error would be returned, then the function will also ASSERT().513514@param Buffer The pointer to the output buffer for the produced515Null-terminated Unicode string.516@param BufferSize The size of Buffer in bytes, including the517Null-terminator.518@param Flags The bitmask of flags that specify left justification,519zero pad, and commas.520@param Value The 64-bit signed value to convert to a string.521@param Width The maximum number of Unicode characters to place in522Buffer, not including the Null-terminator.523524@retval RETURN_SUCCESS The decimal value is converted.525@retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted526value.527@retval RETURN_INVALID_PARAMETER If Buffer is NULL.528If PcdMaximumUnicodeStringLength is not529zero, and BufferSize is greater than530(PcdMaximumUnicodeStringLength *531sizeof (CHAR16) + 1).532If unsupported bits are set in Flags.533If both COMMA_TYPE and RADIX_HEX are set in534Flags.535If Width >= MAXIMUM_VALUE_CHARACTERS.536537**/538RETURN_STATUS539EFIAPI540UnicodeValueToStringS (541IN OUT CHAR16 *Buffer,542IN UINTN BufferSize,543IN UINTN Flags,544IN INT64 Value,545IN UINTN Width546);547548/**549Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated550ASCII format string and a VA_LIST argument list.551552This function is similar as vsnprintf_s defined in C11.553554Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer555and BufferSize.556The ASCII string is produced by parsing the format string specified by FormatString.557Arguments are pulled from the variable argument list specified by Marker based on558the contents of the format string.559The number of ASCII characters in the produced output buffer is returned not including560the Null-terminator.561562If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is563unmodified and 0 is returned.564If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is565unmodified and 0 is returned.566If PcdMaximumAsciiStringLength is not zero, and BufferSize >567(PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer568is unmodified and 0 is returned.569If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than570PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then571ASSERT(). Also, the output buffer is unmodified and 0 is returned.572573If BufferSize is 0, then no output buffer is produced and 0 is returned.574575@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated576ASCII string.577@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.578@param FormatString A Null-terminated ASCII format string.579@param Marker VA_LIST marker for the variable argument list.580581@return The number of ASCII characters in the produced output buffer not including the582Null-terminator.583584**/585UINTN586EFIAPI587AsciiVSPrint (588OUT CHAR8 *StartOfBuffer,589IN UINTN BufferSize,590IN CONST CHAR8 *FormatString,591IN VA_LIST Marker592);593594/**595Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated596ASCII format string and a BASE_LIST argument list.597598Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer599and BufferSize.600The ASCII string is produced by parsing the format string specified by FormatString.601Arguments are pulled from the variable argument list specified by Marker based on602the contents of the format string.603The number of ASCII characters in the produced output buffer is returned not including604the Null-terminator.605606If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is607unmodified and 0 is returned.608If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is609unmodified and 0 is returned.610If PcdMaximumAsciiStringLength is not zero, and BufferSize >611(PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer612is unmodified and 0 is returned.613If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than614PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then615ASSERT(). Also, the output buffer is unmodified and 0 is returned.616617If BufferSize is 0, then no output buffer is produced and 0 is returned.618619@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated620ASCII string.621@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.622@param FormatString A Null-terminated ASCII format string.623@param Marker BASE_LIST marker for the variable argument list.624625@return The number of ASCII characters in the produced output buffer not including the626Null-terminator.627628**/629UINTN630EFIAPI631AsciiBSPrint (632OUT CHAR8 *StartOfBuffer,633IN UINTN BufferSize,634IN CONST CHAR8 *FormatString,635IN BASE_LIST Marker636);637638/**639Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated640ASCII format string and variable argument list.641642This function is similar as snprintf_s defined in C11.643644Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer645and BufferSize.646The ASCII string is produced by parsing the format string specified by FormatString.647Arguments are pulled from the variable argument list based on the contents of the648format string.649The number of ASCII characters in the produced output buffer is returned not including650the Null-terminator.651652If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is653unmodified and 0 is returned.654If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is655unmodified and 0 is returned.656If PcdMaximumAsciiStringLength is not zero, and BufferSize >657(PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer658is unmodified and 0 is returned.659If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than660PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then661ASSERT(). Also, the output buffer is unmodified and 0 is returned.662663If BufferSize is 0, then no output buffer is produced and 0 is returned.664665@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated666ASCII string.667@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.668@param FormatString A Null-terminated ASCII format string.669@param ... Variable argument list whose contents are accessed based on the670format string specified by FormatString.671672@return The number of ASCII characters in the produced output buffer not including the673Null-terminator.674675**/676UINTN677EFIAPI678AsciiSPrint (679OUT CHAR8 *StartOfBuffer,680IN UINTN BufferSize,681IN CONST CHAR8 *FormatString,682...683);684685/**686Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated687Unicode format string and a VA_LIST argument list.688689This function is similar as vsnprintf_s defined in C11.690691Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer692and BufferSize.693The ASCII string is produced by parsing the format string specified by FormatString.694Arguments are pulled from the variable argument list specified by Marker based on695the contents of the format string.696The number of ASCII characters in the produced output buffer is returned not including697the Null-terminator.698699If FormatString is not aligned on a 16-bit boundary, then ASSERT().700701If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is702unmodified and 0 is returned.703If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is704unmodified and 0 is returned.705If PcdMaximumAsciiStringLength is not zero, and BufferSize >706(PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer707is unmodified and 0 is returned.708If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than709PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then710ASSERT(). Also, the output buffer is unmodified and 0 is returned.711712If BufferSize is 0, then no output buffer is produced and 0 is returned.713714@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated715ASCII string.716@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.717@param FormatString A Null-terminated Unicode format string.718@param Marker VA_LIST marker for the variable argument list.719720@return The number of ASCII characters in the produced output buffer not including the721Null-terminator.722723**/724UINTN725EFIAPI726AsciiVSPrintUnicodeFormat (727OUT CHAR8 *StartOfBuffer,728IN UINTN BufferSize,729IN CONST CHAR16 *FormatString,730IN VA_LIST Marker731);732733/**734Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated735Unicode format string and a BASE_LIST argument list.736737Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer738and BufferSize.739The ASCII string is produced by parsing the format string specified by FormatString.740Arguments are pulled from the variable argument list specified by Marker based on741the contents of the format string.742The number of ASCII characters in the produced output buffer is returned not including743the Null-terminator.744745If FormatString is not aligned on a 16-bit boundary, then ASSERT().746747If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is748unmodified and 0 is returned.749If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is750unmodified and 0 is returned.751If PcdMaximumAsciiStringLength is not zero, and BufferSize >752(PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer753is unmodified and 0 is returned.754If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than755PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then756ASSERT(). Also, the output buffer is unmodified and 0 is returned.757758If BufferSize is 0, then no output buffer is produced and 0 is returned.759760@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated761ASCII string.762@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.763@param FormatString A Null-terminated Unicode format string.764@param Marker BASE_LIST marker for the variable argument list.765766@return The number of ASCII characters in the produced output buffer not including the767Null-terminator.768769**/770UINTN771EFIAPI772AsciiBSPrintUnicodeFormat (773OUT CHAR8 *StartOfBuffer,774IN UINTN BufferSize,775IN CONST CHAR16 *FormatString,776IN BASE_LIST Marker777);778779/**780Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated781Unicode format string and variable argument list.782783This function is similar as snprintf_s defined in C11.784785Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer786and BufferSize.787The ASCII string is produced by parsing the format string specified by FormatString.788Arguments are pulled from the variable argument list based on the contents of the789format string.790The number of ASCII characters in the produced output buffer is returned not including791the Null-terminator.792793If FormatString is not aligned on a 16-bit boundary, then ASSERT().794795If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is796unmodified and 0 is returned.797If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is798unmodified and 0 is returned.799If PcdMaximumAsciiStringLength is not zero, and BufferSize >800(PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer801is unmodified and 0 is returned.802If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than803PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then804ASSERT(). Also, the output buffer is unmodified and 0 is returned.805806If BufferSize is 0, then no output buffer is produced and 0 is returned.807808@param StartOfBuffer A pointer to the output buffer for the produced Null-terminated809ASCII string.810@param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.811@param FormatString A Null-terminated Unicode format string.812@param ... Variable argument list whose contents are accessed based on the813format string specified by FormatString.814815@return The number of ASCII characters in the produced output buffer not including the816Null-terminator.817818**/819UINTN820EFIAPI821AsciiSPrintUnicodeFormat (822OUT CHAR8 *StartOfBuffer,823IN UINTN BufferSize,824IN CONST CHAR16 *FormatString,825...826);827828/**829Converts a decimal value to a Null-terminated Ascii string.830831Converts the decimal number specified by Value to a Null-terminated Ascii832string specified by Buffer containing at most Width characters. No padding of833spaces is ever performed. If Width is 0 then a width of834MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than835Width characters, then only the first Width characters are placed in Buffer.836Additional conversion parameters are specified in Flags.837838The Flags bit LEFT_JUSTIFY is always ignored.839All conversions are left justified in Buffer.840If Width is 0, PREFIX_ZERO is ignored in Flags.841If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and842commas are inserted every 3rd digit starting from the right.843If RADIX_HEX is set in Flags, then the output buffer will be formatted in844hexadecimal format.845If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in846Buffer is a '-'.847If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then848Buffer is padded with '0' characters so the combination of the optional '-'849sign character, '0' characters, digit characters for Value, and the850Null-terminator add up to Width characters.851852If an error would be returned, then the function will ASSERT().853854@param Buffer The pointer to the output buffer for the produced855Null-terminated Ascii string.856@param BufferSize The size of Buffer in bytes, including the857Null-terminator.858@param Flags The bitmask of flags that specify left justification,859zero pad, and commas.860@param Value The 64-bit signed value to convert to a string.861@param Width The maximum number of Ascii characters to place in862Buffer, not including the Null-terminator.863864@retval RETURN_SUCCESS The decimal value is converted.865@retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted866value.867@retval RETURN_INVALID_PARAMETER If Buffer is NULL.868If PcdMaximumAsciiStringLength is not869zero, and BufferSize is greater than870PcdMaximumAsciiStringLength.871If unsupported bits are set in Flags.872If both COMMA_TYPE and RADIX_HEX are set in873Flags.874If Width >= MAXIMUM_VALUE_CHARACTERS.875876**/877RETURN_STATUS878EFIAPI879AsciiValueToStringS (880IN OUT CHAR8 *Buffer,881IN UINTN BufferSize,882IN UINTN Flags,883IN INT64 Value,884IN UINTN Width885);886887/**888Returns the number of characters that would be produced by if the formatted889output were produced not including the Null-terminator.890891If FormatString is not aligned on a 16-bit boundary, then ASSERT().892893If FormatString is NULL, then ASSERT() and 0 is returned.894If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more895than PcdMaximumUnicodeStringLength Unicode characters not including the896Null-terminator, then ASSERT() and 0 is returned.897898@param[in] FormatString A Null-terminated Unicode format string.899@param[in] Marker VA_LIST marker for the variable argument list.900901@return The number of characters that would be produced, not including the902Null-terminator.903**/904UINTN905EFIAPI906SPrintLength (907IN CONST CHAR16 *FormatString,908IN VA_LIST Marker909);910911/**912Returns the number of characters that would be produced by if the formatted913output were produced not including the Null-terminator.914915If FormatString is NULL, then ASSERT() and 0 is returned.916If PcdMaximumAsciiStringLength is not zero, and FormatString contains more917than PcdMaximumAsciiStringLength Ascii characters not including the918Null-terminator, then ASSERT() and 0 is returned.919920@param[in] FormatString A Null-terminated ASCII format string.921@param[in] Marker VA_LIST marker for the variable argument list.922923@return The number of characters that would be produced, not including the924Null-terminator.925**/926UINTN927EFIAPI928SPrintLengthAsciiFormat (929IN CONST CHAR8 *FormatString,930IN VA_LIST Marker931);932933#endif934935936