1*0d1ba665SWarner Losh /** @file 2*0d1ba665SWarner Losh Provides services to print a formatted string to a buffer. All combinations of 3*0d1ba665SWarner Losh Unicode and ASCII strings are supported. 4*0d1ba665SWarner Losh 5*0d1ba665SWarner Losh Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR> 6*0d1ba665SWarner Losh This program and the accompanying materials are licensed and made available under 7*0d1ba665SWarner Losh the terms and conditions of the BSD License that accompanies this distribution. 8*0d1ba665SWarner Losh The full text of the license may be found at 9*0d1ba665SWarner Losh http://opensource.org/licenses/bsd-license.php. 10*0d1ba665SWarner Losh 11*0d1ba665SWarner Losh THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12*0d1ba665SWarner Losh WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13*0d1ba665SWarner Losh 14*0d1ba665SWarner Losh The Print Library functions provide a simple means to produce formatted output 15*0d1ba665SWarner Losh strings. Many of the output functions use a format string to describe how to 16*0d1ba665SWarner Losh format the output of variable arguments. The format string consists of normal 17*0d1ba665SWarner Losh text and argument descriptors. There are no restrictions for how the normal 18*0d1ba665SWarner Losh text and argument descriptors can be mixed. The following end of line(EOL) 19*0d1ba665SWarner Losh translations must be performed on the contents of the format string: 20*0d1ba665SWarner Losh 21*0d1ba665SWarner Losh - '\\r' is translated to '\\r' 22*0d1ba665SWarner Losh - '\\r\\n' is translated to '\\r\\n' 23*0d1ba665SWarner Losh - '\\n' is translated to '\\r\\n' 24*0d1ba665SWarner Losh - '\\n\\r' is translated to '\\r\\n' 25*0d1ba665SWarner Losh 26*0d1ba665SWarner Losh This does not follow the ANSI C standard for sprint(). The format of argument 27*0d1ba665SWarner Losh descriptors is described below. The ANSI C standard for sprint() has been 28*0d1ba665SWarner Losh followed for some of the format types, and has not been followed for others. 29*0d1ba665SWarner Losh The exceptions are noted below. 30*0d1ba665SWarner Losh 31*0d1ba665SWarner Losh %[flags][width][.precision]type 32*0d1ba665SWarner Losh 33*0d1ba665SWarner Losh [flags]: 34*0d1ba665SWarner Losh - - 35*0d1ba665SWarner Losh - The field is left justified. If not flag is not specified, then the 36*0d1ba665SWarner Losh field is right justified. 37*0d1ba665SWarner Losh - space 38*0d1ba665SWarner Losh - Prefix a space character to a number. Only valid for types X, x, and d. 39*0d1ba665SWarner Losh - + 40*0d1ba665SWarner Losh - Prefix a plus character to a number. Only valid for types X, x, and d. 41*0d1ba665SWarner Losh If both space and + are specified, then space is ignored. 42*0d1ba665SWarner Losh - 0 43*0d1ba665SWarner Losh - Pad with 0 characters to the left of a number. Only valid for types 44*0d1ba665SWarner Losh X, x, and d. 45*0d1ba665SWarner Losh - , 46*0d1ba665SWarner Losh - Place a comma every 3rd digit of the number. Only valid for type d. 47*0d1ba665SWarner Losh If 0 is also specified, then 0 is ignored. 48*0d1ba665SWarner Losh - L, l 49*0d1ba665SWarner Losh - The number being printed is size UINT64. Only valid for types X, x, and d. 50*0d1ba665SWarner Losh If this flag is not specified, then the number being printed is size int. 51*0d1ba665SWarner Losh - NOTE: All invalid flags are ignored. 52*0d1ba665SWarner Losh 53*0d1ba665SWarner Losh [width]: 54*0d1ba665SWarner Losh 55*0d1ba665SWarner Losh - * 56*0d1ba665SWarner Losh - The width of the field is specified by a UINTN argument in the 57*0d1ba665SWarner Losh argument list. 58*0d1ba665SWarner Losh - number 59*0d1ba665SWarner Losh - The number specified as a decimal value represents the width of 60*0d1ba665SWarner Losh the field. 61*0d1ba665SWarner Losh - NOTE: If [width] is not specified, then a field width of 0 is assumed. 62*0d1ba665SWarner Losh 63*0d1ba665SWarner Losh [.precision]: 64*0d1ba665SWarner Losh 65*0d1ba665SWarner Losh - * 66*0d1ba665SWarner Losh - The precision of the field is specified by a UINTN argument in the 67*0d1ba665SWarner Losh argument list. 68*0d1ba665SWarner Losh - number 69*0d1ba665SWarner Losh - The number specified as a decimal value represents the precision of 70*0d1ba665SWarner Losh the field. 71*0d1ba665SWarner Losh - NOTE: If [.precision] is not specified, then a precision of 0 is assumed. 72*0d1ba665SWarner Losh 73*0d1ba665SWarner Losh type: 74*0d1ba665SWarner Losh 75*0d1ba665SWarner Losh - % 76*0d1ba665SWarner Losh - Print a %%. 77*0d1ba665SWarner Losh - c 78*0d1ba665SWarner Losh - The argument is a Unicode character. ASCII characters can be printed 79*0d1ba665SWarner Losh using this type too by making sure bits 8..15 of the argument are set to 0. 80*0d1ba665SWarner Losh - x 81*0d1ba665SWarner Losh - The argument is an unsigned hexadecimal number. The characters used are 0..9 and 82*0d1ba665SWarner Losh A..F. If the flag 'L' is not specified, then the argument is assumed 83*0d1ba665SWarner Losh to be size int. This does not follow ANSI C. 84*0d1ba665SWarner Losh - X 85*0d1ba665SWarner Losh - The argument is an unsigned hexadecimal number and the number is padded with 86*0d1ba665SWarner Losh zeros. This is equivalent to a format string of "0x". If the flag 87*0d1ba665SWarner Losh 'L' is not specified, then the argument is assumed to be size int. 88*0d1ba665SWarner Losh This does not follow ANSI C. 89*0d1ba665SWarner Losh - d 90*0d1ba665SWarner Losh - The argument is a signed decimal number. If the flag 'L' is not specified, 91*0d1ba665SWarner Losh then the argument is assumed to be size int. 92*0d1ba665SWarner Losh - u 93*0d1ba665SWarner Losh - The argument is a unsigned decimal number. If the flag 'L' is not specified, 94*0d1ba665SWarner Losh then the argument is assumed to be size int. 95*0d1ba665SWarner Losh - p 96*0d1ba665SWarner Losh - The argument is a pointer that is a (VOID *), and it is printed as an 97*0d1ba665SWarner Losh unsigned hexadecimal number The characters used are 0..9 and A..F. 98*0d1ba665SWarner Losh - a 99*0d1ba665SWarner Losh - The argument is a pointer to an ASCII string. 100*0d1ba665SWarner Losh This does not follow ANSI C. 101*0d1ba665SWarner Losh - S, s 102*0d1ba665SWarner Losh - The argument is a pointer to a Unicode string. 103*0d1ba665SWarner Losh This does not follow ANSI C. 104*0d1ba665SWarner Losh - g 105*0d1ba665SWarner Losh - The argument is a pointer to a GUID structure. The GUID is printed 106*0d1ba665SWarner Losh in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX. 107*0d1ba665SWarner Losh This does not follow ANSI C. 108*0d1ba665SWarner Losh - t 109*0d1ba665SWarner Losh - The argument is a pointer to an EFI_TIME structure. The time and 110*0d1ba665SWarner Losh date are printed in the format "mm/dd/yyyy hh:mm" where mm is the 111*0d1ba665SWarner Losh month zero padded, dd is the day zero padded, yyyy is the year zero 112*0d1ba665SWarner Losh padded, hh is the hour zero padded, and mm is minutes zero padded. 113*0d1ba665SWarner Losh This does not follow ANSI C. 114*0d1ba665SWarner Losh - r 115*0d1ba665SWarner Losh - The argument is a RETURN_STATUS value. This value is converted to 116*0d1ba665SWarner Losh a string following the table below. This does not follow ANSI C. 117*0d1ba665SWarner Losh - RETURN_SUCCESS 118*0d1ba665SWarner Losh - "Success" 119*0d1ba665SWarner Losh - RETURN_LOAD_ERROR 120*0d1ba665SWarner Losh - "Load Error" 121*0d1ba665SWarner Losh - RETURN_INVALID_PARAMETER 122*0d1ba665SWarner Losh - "Invalid Parameter" 123*0d1ba665SWarner Losh - RETURN_UNSUPPORTED 124*0d1ba665SWarner Losh - "Unsupported" 125*0d1ba665SWarner Losh - RETURN_BAD_BUFFER_SIZE 126*0d1ba665SWarner Losh - "Bad Buffer Size" 127*0d1ba665SWarner Losh - RETURN_BUFFER_TOO_SMALL 128*0d1ba665SWarner Losh - "Buffer Too Small" 129*0d1ba665SWarner Losh - RETURN_NOT_READY 130*0d1ba665SWarner Losh - "Not Ready" 131*0d1ba665SWarner Losh - RETURN_DEVICE_ERROR 132*0d1ba665SWarner Losh - "Device Error" 133*0d1ba665SWarner Losh - RETURN_WRITE_PROTECTED 134*0d1ba665SWarner Losh - "Write Protected" 135*0d1ba665SWarner Losh - RETURN_OUT_OF_RESOURCES 136*0d1ba665SWarner Losh - "Out of Resources" 137*0d1ba665SWarner Losh - RETURN_VOLUME_CORRUPTED 138*0d1ba665SWarner Losh - "Volume Corrupt" 139*0d1ba665SWarner Losh - RETURN_VOLUME_FULL 140*0d1ba665SWarner Losh - "Volume Full" 141*0d1ba665SWarner Losh - RETURN_NO_MEDIA 142*0d1ba665SWarner Losh - "No Media" 143*0d1ba665SWarner Losh - RETURN_MEDIA_CHANGED 144*0d1ba665SWarner Losh - "Media changed" 145*0d1ba665SWarner Losh - RETURN_NOT_FOUND 146*0d1ba665SWarner Losh - "Not Found" 147*0d1ba665SWarner Losh - RETURN_ACCESS_DENIED 148*0d1ba665SWarner Losh - "Access Denied" 149*0d1ba665SWarner Losh - RETURN_NO_RESPONSE 150*0d1ba665SWarner Losh - "No Response" 151*0d1ba665SWarner Losh - RETURN_NO_MAPPING 152*0d1ba665SWarner Losh - "No mapping" 153*0d1ba665SWarner Losh - RETURN_TIMEOUT 154*0d1ba665SWarner Losh - "Time out" 155*0d1ba665SWarner Losh - RETURN_NOT_STARTED 156*0d1ba665SWarner Losh - "Not started" 157*0d1ba665SWarner Losh - RETURN_ALREADY_STARTED 158*0d1ba665SWarner Losh - "Already started" 159*0d1ba665SWarner Losh - RETURN_ABORTED 160*0d1ba665SWarner Losh - "Aborted" 161*0d1ba665SWarner Losh - RETURN_ICMP_ERROR 162*0d1ba665SWarner Losh - "ICMP Error" 163*0d1ba665SWarner Losh - RETURN_TFTP_ERROR 164*0d1ba665SWarner Losh - "TFTP Error" 165*0d1ba665SWarner Losh - RETURN_PROTOCOL_ERROR 166*0d1ba665SWarner Losh - "Protocol Error" 167*0d1ba665SWarner Losh - RETURN_WARN_UNKNOWN_GLYPH 168*0d1ba665SWarner Losh - "Warning Unknown Glyph" 169*0d1ba665SWarner Losh - RETURN_WARN_DELETE_FAILURE 170*0d1ba665SWarner Losh - "Warning Delete Failure" 171*0d1ba665SWarner Losh - RETURN_WARN_WRITE_FAILURE 172*0d1ba665SWarner Losh - "Warning Write Failure" 173*0d1ba665SWarner Losh - RETURN_WARN_BUFFER_TOO_SMALL 174*0d1ba665SWarner Losh - "Warning Buffer Too Small" 175*0d1ba665SWarner Losh 176*0d1ba665SWarner Losh **/ 177*0d1ba665SWarner Losh 178*0d1ba665SWarner Losh #ifndef __PRINT_LIB_H__ 179*0d1ba665SWarner Losh #define __PRINT_LIB_H__ 180*0d1ba665SWarner Losh 181*0d1ba665SWarner Losh /// 182*0d1ba665SWarner Losh /// Define the maximum number of characters that are required to 183*0d1ba665SWarner Losh /// encode with a NULL terminator a decimal, hexadecimal, GUID, 184*0d1ba665SWarner Losh /// or TIME value. 185*0d1ba665SWarner Losh /// 186*0d1ba665SWarner Losh /// Maximum Length Decimal String = 28 187*0d1ba665SWarner Losh /// "-9,223,372,036,854,775,808" 188*0d1ba665SWarner Losh /// Maximum Length Hexadecimal String = 17 189*0d1ba665SWarner Losh /// "FFFFFFFFFFFFFFFF" 190*0d1ba665SWarner Losh /// Maximum Length GUID = 37 191*0d1ba665SWarner Losh /// "00000000-0000-0000-0000-000000000000" 192*0d1ba665SWarner Losh /// Maximum Length TIME = 18 193*0d1ba665SWarner Losh /// "12/12/2006 12:12" 194*0d1ba665SWarner Losh /// 195*0d1ba665SWarner Losh #define MAXIMUM_VALUE_CHARACTERS 38 196*0d1ba665SWarner Losh 197*0d1ba665SWarner Losh /// 198*0d1ba665SWarner Losh /// Flags bitmask values use in UnicodeValueToString() and 199*0d1ba665SWarner Losh /// AsciiValueToString() 200*0d1ba665SWarner Losh /// 201*0d1ba665SWarner Losh #define LEFT_JUSTIFY 0x01 202*0d1ba665SWarner Losh #define COMMA_TYPE 0x08 203*0d1ba665SWarner Losh #define PREFIX_ZERO 0x20 204*0d1ba665SWarner Losh #define RADIX_HEX 0x80 205*0d1ba665SWarner Losh 206*0d1ba665SWarner Losh /** 207*0d1ba665SWarner Losh Produces a Null-terminated Unicode string in an output buffer based on 208*0d1ba665SWarner Losh a Null-terminated Unicode format string and a VA_LIST argument list. 209*0d1ba665SWarner Losh 210*0d1ba665SWarner Losh This function is similar as vsnprintf_s defined in C11. 211*0d1ba665SWarner Losh 212*0d1ba665SWarner Losh Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer 213*0d1ba665SWarner Losh and BufferSize. 214*0d1ba665SWarner Losh The Unicode string is produced by parsing the format string specified by FormatString. 215*0d1ba665SWarner Losh Arguments are pulled from the variable argument list specified by Marker based on the 216*0d1ba665SWarner Losh contents of the format string. 217*0d1ba665SWarner Losh The number of Unicode characters in the produced output buffer is returned not including 218*0d1ba665SWarner Losh the Null-terminator. 219*0d1ba665SWarner Losh 220*0d1ba665SWarner Losh If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 221*0d1ba665SWarner Losh If FormatString is not aligned on a 16-bit boundary, then ASSERT(). 222*0d1ba665SWarner Losh 223*0d1ba665SWarner Losh If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 224*0d1ba665SWarner Losh unmodified and 0 is returned. 225*0d1ba665SWarner Losh If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is 226*0d1ba665SWarner Losh unmodified and 0 is returned. 227*0d1ba665SWarner Losh If PcdMaximumUnicodeStringLength is not zero, and BufferSize > 228*0d1ba665SWarner Losh (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output 229*0d1ba665SWarner Losh buffer is unmodified and 0 is returned. 230*0d1ba665SWarner Losh If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 231*0d1ba665SWarner Losh PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then 232*0d1ba665SWarner Losh ASSERT(). Also, the output buffer is unmodified and 0 is returned. 233*0d1ba665SWarner Losh 234*0d1ba665SWarner Losh If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. 235*0d1ba665SWarner Losh 236*0d1ba665SWarner Losh @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated 237*0d1ba665SWarner Losh Unicode string. 238*0d1ba665SWarner Losh @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. 239*0d1ba665SWarner Losh @param FormatString A Null-terminated Unicode format string. 240*0d1ba665SWarner Losh @param Marker VA_LIST marker for the variable argument list. 241*0d1ba665SWarner Losh 242*0d1ba665SWarner Losh @return The number of Unicode characters in the produced output buffer not including the 243*0d1ba665SWarner Losh Null-terminator. 244*0d1ba665SWarner Losh 245*0d1ba665SWarner Losh **/ 246*0d1ba665SWarner Losh UINTN 247*0d1ba665SWarner Losh EFIAPI 248*0d1ba665SWarner Losh UnicodeVSPrint ( 249*0d1ba665SWarner Losh OUT CHAR16 *StartOfBuffer, 250*0d1ba665SWarner Losh IN UINTN BufferSize, 251*0d1ba665SWarner Losh IN CONST CHAR16 *FormatString, 252*0d1ba665SWarner Losh IN VA_LIST Marker 253*0d1ba665SWarner Losh ); 254*0d1ba665SWarner Losh 255*0d1ba665SWarner Losh /** 256*0d1ba665SWarner Losh Produces a Null-terminated Unicode string in an output buffer based on 257*0d1ba665SWarner Losh a Null-terminated Unicode format string and a BASE_LIST argument list. 258*0d1ba665SWarner Losh 259*0d1ba665SWarner Losh Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer 260*0d1ba665SWarner Losh and BufferSize. 261*0d1ba665SWarner Losh The Unicode string is produced by parsing the format string specified by FormatString. 262*0d1ba665SWarner Losh Arguments are pulled from the variable argument list specified by Marker based on the 263*0d1ba665SWarner Losh contents of the format string. 264*0d1ba665SWarner Losh The number of Unicode characters in the produced output buffer is returned not including 265*0d1ba665SWarner Losh the Null-terminator. 266*0d1ba665SWarner Losh 267*0d1ba665SWarner Losh If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 268*0d1ba665SWarner Losh If FormatString is not aligned on a 16-bit boundary, then ASSERT(). 269*0d1ba665SWarner Losh 270*0d1ba665SWarner Losh If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 271*0d1ba665SWarner Losh unmodified and 0 is returned. 272*0d1ba665SWarner Losh If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is 273*0d1ba665SWarner Losh unmodified and 0 is returned. 274*0d1ba665SWarner Losh If PcdMaximumUnicodeStringLength is not zero, and BufferSize > 275*0d1ba665SWarner Losh (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output 276*0d1ba665SWarner Losh buffer is unmodified and 0 is returned. 277*0d1ba665SWarner Losh If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 278*0d1ba665SWarner Losh PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then 279*0d1ba665SWarner Losh ASSERT(). Also, the output buffer is unmodified and 0 is returned. 280*0d1ba665SWarner Losh 281*0d1ba665SWarner Losh If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. 282*0d1ba665SWarner Losh 283*0d1ba665SWarner Losh @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated 284*0d1ba665SWarner Losh Unicode string. 285*0d1ba665SWarner Losh @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. 286*0d1ba665SWarner Losh @param FormatString A Null-terminated Unicode format string. 287*0d1ba665SWarner Losh @param Marker BASE_LIST marker for the variable argument list. 288*0d1ba665SWarner Losh 289*0d1ba665SWarner Losh @return The number of Unicode characters in the produced output buffer not including the 290*0d1ba665SWarner Losh Null-terminator. 291*0d1ba665SWarner Losh 292*0d1ba665SWarner Losh **/ 293*0d1ba665SWarner Losh UINTN 294*0d1ba665SWarner Losh EFIAPI 295*0d1ba665SWarner Losh UnicodeBSPrint ( 296*0d1ba665SWarner Losh OUT CHAR16 *StartOfBuffer, 297*0d1ba665SWarner Losh IN UINTN BufferSize, 298*0d1ba665SWarner Losh IN CONST CHAR16 *FormatString, 299*0d1ba665SWarner Losh IN BASE_LIST Marker 300*0d1ba665SWarner Losh ); 301*0d1ba665SWarner Losh 302*0d1ba665SWarner Losh /** 303*0d1ba665SWarner Losh Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated 304*0d1ba665SWarner Losh Unicode format string and variable argument list. 305*0d1ba665SWarner Losh 306*0d1ba665SWarner Losh This function is similar as snprintf_s defined in C11. 307*0d1ba665SWarner Losh 308*0d1ba665SWarner Losh Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer 309*0d1ba665SWarner Losh and BufferSize. 310*0d1ba665SWarner Losh The Unicode string is produced by parsing the format string specified by FormatString. 311*0d1ba665SWarner Losh Arguments are pulled from the variable argument list based on the contents of the format string. 312*0d1ba665SWarner Losh The number of Unicode characters in the produced output buffer is returned not including 313*0d1ba665SWarner Losh the Null-terminator. 314*0d1ba665SWarner Losh 315*0d1ba665SWarner Losh If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 316*0d1ba665SWarner Losh If FormatString is not aligned on a 16-bit boundary, then ASSERT(). 317*0d1ba665SWarner Losh 318*0d1ba665SWarner Losh If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 319*0d1ba665SWarner Losh unmodified and 0 is returned. 320*0d1ba665SWarner Losh If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is 321*0d1ba665SWarner Losh unmodified and 0 is returned. 322*0d1ba665SWarner Losh If PcdMaximumUnicodeStringLength is not zero, and BufferSize > 323*0d1ba665SWarner Losh (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output 324*0d1ba665SWarner Losh buffer is unmodified and 0 is returned. 325*0d1ba665SWarner Losh If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 326*0d1ba665SWarner Losh PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then 327*0d1ba665SWarner Losh ASSERT(). Also, the output buffer is unmodified and 0 is returned. 328*0d1ba665SWarner Losh 329*0d1ba665SWarner Losh If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. 330*0d1ba665SWarner Losh 331*0d1ba665SWarner Losh @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated 332*0d1ba665SWarner Losh Unicode string. 333*0d1ba665SWarner Losh @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. 334*0d1ba665SWarner Losh @param FormatString A Null-terminated Unicode format string. 335*0d1ba665SWarner Losh @param ... Variable argument list whose contents are accessed based on the 336*0d1ba665SWarner Losh format string specified by FormatString. 337*0d1ba665SWarner Losh 338*0d1ba665SWarner Losh @return The number of Unicode characters in the produced output buffer not including the 339*0d1ba665SWarner Losh Null-terminator. 340*0d1ba665SWarner Losh 341*0d1ba665SWarner Losh **/ 342*0d1ba665SWarner Losh UINTN 343*0d1ba665SWarner Losh EFIAPI 344*0d1ba665SWarner Losh UnicodeSPrint ( 345*0d1ba665SWarner Losh OUT CHAR16 *StartOfBuffer, 346*0d1ba665SWarner Losh IN UINTN BufferSize, 347*0d1ba665SWarner Losh IN CONST CHAR16 *FormatString, 348*0d1ba665SWarner Losh ... 349*0d1ba665SWarner Losh ); 350*0d1ba665SWarner Losh 351*0d1ba665SWarner Losh /** 352*0d1ba665SWarner Losh Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated 353*0d1ba665SWarner Losh ASCII format string and a VA_LIST argument list. 354*0d1ba665SWarner Losh 355*0d1ba665SWarner Losh This function is similar as vsnprintf_s defined in C11. 356*0d1ba665SWarner Losh 357*0d1ba665SWarner Losh Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer 358*0d1ba665SWarner Losh and BufferSize. 359*0d1ba665SWarner Losh The Unicode string is produced by parsing the format string specified by FormatString. 360*0d1ba665SWarner Losh Arguments are pulled from the variable argument list specified by Marker based on the 361*0d1ba665SWarner Losh contents of the format string. 362*0d1ba665SWarner Losh The number of Unicode characters in the produced output buffer is returned not including 363*0d1ba665SWarner Losh the Null-terminator. 364*0d1ba665SWarner Losh 365*0d1ba665SWarner Losh If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 366*0d1ba665SWarner Losh 367*0d1ba665SWarner Losh If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 368*0d1ba665SWarner Losh unmodified and 0 is returned. 369*0d1ba665SWarner Losh If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is 370*0d1ba665SWarner Losh unmodified and 0 is returned. 371*0d1ba665SWarner Losh If PcdMaximumUnicodeStringLength is not zero, and BufferSize > 372*0d1ba665SWarner Losh (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output 373*0d1ba665SWarner Losh buffer is unmodified and 0 is returned. 374*0d1ba665SWarner Losh If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than 375*0d1ba665SWarner Losh PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then 376*0d1ba665SWarner Losh ASSERT(). Also, the output buffer is unmodified and 0 is returned. 377*0d1ba665SWarner Losh 378*0d1ba665SWarner Losh If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. 379*0d1ba665SWarner Losh 380*0d1ba665SWarner Losh @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated 381*0d1ba665SWarner Losh Unicode string. 382*0d1ba665SWarner Losh @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. 383*0d1ba665SWarner Losh @param FormatString A Null-terminated ASCII format string. 384*0d1ba665SWarner Losh @param Marker VA_LIST marker for the variable argument list. 385*0d1ba665SWarner Losh 386*0d1ba665SWarner Losh @return The number of Unicode characters in the produced output buffer not including the 387*0d1ba665SWarner Losh Null-terminator. 388*0d1ba665SWarner Losh 389*0d1ba665SWarner Losh **/ 390*0d1ba665SWarner Losh UINTN 391*0d1ba665SWarner Losh EFIAPI 392*0d1ba665SWarner Losh UnicodeVSPrintAsciiFormat ( 393*0d1ba665SWarner Losh OUT CHAR16 *StartOfBuffer, 394*0d1ba665SWarner Losh IN UINTN BufferSize, 395*0d1ba665SWarner Losh IN CONST CHAR8 *FormatString, 396*0d1ba665SWarner Losh IN VA_LIST Marker 397*0d1ba665SWarner Losh ); 398*0d1ba665SWarner Losh 399*0d1ba665SWarner Losh /** 400*0d1ba665SWarner Losh Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated 401*0d1ba665SWarner Losh ASCII format string and a BASE_LIST argument list. 402*0d1ba665SWarner Losh 403*0d1ba665SWarner Losh Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer 404*0d1ba665SWarner Losh and BufferSize. 405*0d1ba665SWarner Losh The Unicode string is produced by parsing the format string specified by FormatString. 406*0d1ba665SWarner Losh Arguments are pulled from the variable argument list specified by Marker based on the 407*0d1ba665SWarner Losh contents of the format string. 408*0d1ba665SWarner Losh The number of Unicode characters in the produced output buffer is returned not including 409*0d1ba665SWarner Losh the Null-terminator. 410*0d1ba665SWarner Losh 411*0d1ba665SWarner Losh If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 412*0d1ba665SWarner Losh 413*0d1ba665SWarner Losh If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 414*0d1ba665SWarner Losh unmodified and 0 is returned. 415*0d1ba665SWarner Losh If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is 416*0d1ba665SWarner Losh unmodified and 0 is returned. 417*0d1ba665SWarner Losh If PcdMaximumUnicodeStringLength is not zero, and BufferSize > 418*0d1ba665SWarner Losh (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output 419*0d1ba665SWarner Losh buffer is unmodified and 0 is returned. 420*0d1ba665SWarner Losh If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than 421*0d1ba665SWarner Losh PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then 422*0d1ba665SWarner Losh ASSERT(). Also, the output buffer is unmodified and 0 is returned. 423*0d1ba665SWarner Losh 424*0d1ba665SWarner Losh If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. 425*0d1ba665SWarner Losh 426*0d1ba665SWarner Losh @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated 427*0d1ba665SWarner Losh Unicode string. 428*0d1ba665SWarner Losh @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. 429*0d1ba665SWarner Losh @param FormatString A Null-terminated ASCII format string. 430*0d1ba665SWarner Losh @param Marker BASE_LIST marker for the variable argument list. 431*0d1ba665SWarner Losh 432*0d1ba665SWarner Losh @return The number of Unicode characters in the produced output buffer not including the 433*0d1ba665SWarner Losh Null-terminator. 434*0d1ba665SWarner Losh 435*0d1ba665SWarner Losh **/ 436*0d1ba665SWarner Losh UINTN 437*0d1ba665SWarner Losh EFIAPI 438*0d1ba665SWarner Losh UnicodeBSPrintAsciiFormat ( 439*0d1ba665SWarner Losh OUT CHAR16 *StartOfBuffer, 440*0d1ba665SWarner Losh IN UINTN BufferSize, 441*0d1ba665SWarner Losh IN CONST CHAR8 *FormatString, 442*0d1ba665SWarner Losh IN BASE_LIST Marker 443*0d1ba665SWarner Losh ); 444*0d1ba665SWarner Losh 445*0d1ba665SWarner Losh /** 446*0d1ba665SWarner Losh Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated 447*0d1ba665SWarner Losh ASCII format string and variable argument list. 448*0d1ba665SWarner Losh 449*0d1ba665SWarner Losh This function is similar as snprintf_s defined in C11. 450*0d1ba665SWarner Losh 451*0d1ba665SWarner Losh Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer 452*0d1ba665SWarner Losh and BufferSize. 453*0d1ba665SWarner Losh The Unicode string is produced by parsing the format string specified by FormatString. 454*0d1ba665SWarner Losh Arguments are pulled from the variable argument list based on the contents of the 455*0d1ba665SWarner Losh format string. 456*0d1ba665SWarner Losh The number of Unicode characters in the produced output buffer is returned not including 457*0d1ba665SWarner Losh the Null-terminator. 458*0d1ba665SWarner Losh 459*0d1ba665SWarner Losh If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT(). 460*0d1ba665SWarner Losh 461*0d1ba665SWarner Losh If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 462*0d1ba665SWarner Losh unmodified and 0 is returned. 463*0d1ba665SWarner Losh If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is 464*0d1ba665SWarner Losh unmodified and 0 is returned. 465*0d1ba665SWarner Losh If PcdMaximumUnicodeStringLength is not zero, and BufferSize > 466*0d1ba665SWarner Losh (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output 467*0d1ba665SWarner Losh buffer is unmodified and 0 is returned. 468*0d1ba665SWarner Losh If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than 469*0d1ba665SWarner Losh PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then 470*0d1ba665SWarner Losh ASSERT(). Also, the output buffer is unmodified and 0 is returned. 471*0d1ba665SWarner Losh 472*0d1ba665SWarner Losh If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. 473*0d1ba665SWarner Losh 474*0d1ba665SWarner Losh @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated 475*0d1ba665SWarner Losh Unicode string. 476*0d1ba665SWarner Losh @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. 477*0d1ba665SWarner Losh @param FormatString A Null-terminated ASCII format string. 478*0d1ba665SWarner Losh @param ... Variable argument list whose contents are accessed based on the 479*0d1ba665SWarner Losh format string specified by FormatString. 480*0d1ba665SWarner Losh 481*0d1ba665SWarner Losh @return The number of Unicode characters in the produced output buffer not including the 482*0d1ba665SWarner Losh Null-terminator. 483*0d1ba665SWarner Losh 484*0d1ba665SWarner Losh **/ 485*0d1ba665SWarner Losh UINTN 486*0d1ba665SWarner Losh EFIAPI 487*0d1ba665SWarner Losh UnicodeSPrintAsciiFormat ( 488*0d1ba665SWarner Losh OUT CHAR16 *StartOfBuffer, 489*0d1ba665SWarner Losh IN UINTN BufferSize, 490*0d1ba665SWarner Losh IN CONST CHAR8 *FormatString, 491*0d1ba665SWarner Losh ... 492*0d1ba665SWarner Losh ); 493*0d1ba665SWarner Losh 494*0d1ba665SWarner Losh #ifndef DISABLE_NEW_DEPRECATED_INTERFACES 495*0d1ba665SWarner Losh 496*0d1ba665SWarner Losh /** 497*0d1ba665SWarner Losh [ATTENTION] This function is deprecated for security reason. 498*0d1ba665SWarner Losh 499*0d1ba665SWarner Losh Converts a decimal value to a Null-terminated Unicode string. 500*0d1ba665SWarner Losh 501*0d1ba665SWarner Losh Converts the decimal number specified by Value to a Null-terminated Unicode 502*0d1ba665SWarner Losh string specified by Buffer containing at most Width characters. No padding of spaces 503*0d1ba665SWarner Losh is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed. 504*0d1ba665SWarner Losh The number of Unicode characters in Buffer is returned, not including the Null-terminator. 505*0d1ba665SWarner Losh If the conversion contains more than Width characters, then only the first 506*0d1ba665SWarner Losh Width characters are returned, and the total number of characters 507*0d1ba665SWarner Losh required to perform the conversion is returned. 508*0d1ba665SWarner Losh Additional conversion parameters are specified in Flags. 509*0d1ba665SWarner Losh 510*0d1ba665SWarner Losh The Flags bit LEFT_JUSTIFY is always ignored. 511*0d1ba665SWarner Losh All conversions are left justified in Buffer. 512*0d1ba665SWarner Losh If Width is 0, PREFIX_ZERO is ignored in Flags. 513*0d1ba665SWarner Losh If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas 514*0d1ba665SWarner Losh are inserted every 3rd digit starting from the right. 515*0d1ba665SWarner Losh If RADIX_HEX is set in Flags, then the output buffer will be 516*0d1ba665SWarner Losh formatted in hexadecimal format. 517*0d1ba665SWarner Losh If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'. 518*0d1ba665SWarner Losh If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, 519*0d1ba665SWarner Losh then Buffer is padded with '0' characters so the combination of the optional '-' 520*0d1ba665SWarner Losh sign character, '0' characters, digit characters for Value, and the Null-terminator 521*0d1ba665SWarner Losh add up to Width characters. 522*0d1ba665SWarner Losh If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT(). 523*0d1ba665SWarner Losh If Buffer is NULL, then ASSERT(). 524*0d1ba665SWarner Losh If Buffer is not aligned on a 16-bit boundary, then ASSERT(). 525*0d1ba665SWarner Losh If unsupported bits are set in Flags, then ASSERT(). 526*0d1ba665SWarner Losh If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT(). 527*0d1ba665SWarner Losh If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT() 528*0d1ba665SWarner Losh 529*0d1ba665SWarner Losh @param Buffer The pointer to the output buffer for the produced Null-terminated 530*0d1ba665SWarner Losh Unicode string. 531*0d1ba665SWarner Losh @param Flags The bitmask of flags that specify left justification, zero pad, and commas. 532*0d1ba665SWarner Losh @param Value The 64-bit signed value to convert to a string. 533*0d1ba665SWarner Losh @param Width The maximum number of Unicode characters to place in Buffer, not including 534*0d1ba665SWarner Losh the Null-terminator. 535*0d1ba665SWarner Losh 536*0d1ba665SWarner Losh @return The number of Unicode characters in Buffer, not including the Null-terminator. 537*0d1ba665SWarner Losh 538*0d1ba665SWarner Losh **/ 539*0d1ba665SWarner Losh UINTN 540*0d1ba665SWarner Losh EFIAPI 541*0d1ba665SWarner Losh UnicodeValueToString ( 542*0d1ba665SWarner Losh IN OUT CHAR16 *Buffer, 543*0d1ba665SWarner Losh IN UINTN Flags, 544*0d1ba665SWarner Losh IN INT64 Value, 545*0d1ba665SWarner Losh IN UINTN Width 546*0d1ba665SWarner Losh ); 547*0d1ba665SWarner Losh 548*0d1ba665SWarner Losh #endif 549*0d1ba665SWarner Losh 550*0d1ba665SWarner Losh /** 551*0d1ba665SWarner Losh Converts a decimal value to a Null-terminated Unicode string. 552*0d1ba665SWarner Losh 553*0d1ba665SWarner Losh Converts the decimal number specified by Value to a Null-terminated Unicode 554*0d1ba665SWarner Losh string specified by Buffer containing at most Width characters. No padding of 555*0d1ba665SWarner Losh spaces is ever performed. If Width is 0 then a width of 556*0d1ba665SWarner Losh MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than 557*0d1ba665SWarner Losh Width characters, then only the first Width characters are placed in Buffer. 558*0d1ba665SWarner Losh Additional conversion parameters are specified in Flags. 559*0d1ba665SWarner Losh 560*0d1ba665SWarner Losh The Flags bit LEFT_JUSTIFY is always ignored. 561*0d1ba665SWarner Losh All conversions are left justified in Buffer. 562*0d1ba665SWarner Losh If Width is 0, PREFIX_ZERO is ignored in Flags. 563*0d1ba665SWarner Losh If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and 564*0d1ba665SWarner Losh commas are inserted every 3rd digit starting from the right. 565*0d1ba665SWarner Losh If RADIX_HEX is set in Flags, then the output buffer will be formatted in 566*0d1ba665SWarner Losh hexadecimal format. 567*0d1ba665SWarner Losh If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in 568*0d1ba665SWarner Losh Buffer is a '-'. 569*0d1ba665SWarner Losh If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then 570*0d1ba665SWarner Losh Buffer is padded with '0' characters so the combination of the optional '-' 571*0d1ba665SWarner Losh sign character, '0' characters, digit characters for Value, and the 572*0d1ba665SWarner Losh Null-terminator add up to Width characters. 573*0d1ba665SWarner Losh 574*0d1ba665SWarner Losh If Buffer is not aligned on a 16-bit boundary, then ASSERT(). 575*0d1ba665SWarner Losh If an error would be returned, then the function will also ASSERT(). 576*0d1ba665SWarner Losh 577*0d1ba665SWarner Losh @param Buffer The pointer to the output buffer for the produced 578*0d1ba665SWarner Losh Null-terminated Unicode string. 579*0d1ba665SWarner Losh @param BufferSize The size of Buffer in bytes, including the 580*0d1ba665SWarner Losh Null-terminator. 581*0d1ba665SWarner Losh @param Flags The bitmask of flags that specify left justification, 582*0d1ba665SWarner Losh zero pad, and commas. 583*0d1ba665SWarner Losh @param Value The 64-bit signed value to convert to a string. 584*0d1ba665SWarner Losh @param Width The maximum number of Unicode characters to place in 585*0d1ba665SWarner Losh Buffer, not including the Null-terminator. 586*0d1ba665SWarner Losh 587*0d1ba665SWarner Losh @retval RETURN_SUCCESS The decimal value is converted. 588*0d1ba665SWarner Losh @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted 589*0d1ba665SWarner Losh value. 590*0d1ba665SWarner Losh @retval RETURN_INVALID_PARAMETER If Buffer is NULL. 591*0d1ba665SWarner Losh If PcdMaximumUnicodeStringLength is not 592*0d1ba665SWarner Losh zero, and BufferSize is greater than 593*0d1ba665SWarner Losh (PcdMaximumUnicodeStringLength * 594*0d1ba665SWarner Losh sizeof (CHAR16) + 1). 595*0d1ba665SWarner Losh If unsupported bits are set in Flags. 596*0d1ba665SWarner Losh If both COMMA_TYPE and RADIX_HEX are set in 597*0d1ba665SWarner Losh Flags. 598*0d1ba665SWarner Losh If Width >= MAXIMUM_VALUE_CHARACTERS. 599*0d1ba665SWarner Losh 600*0d1ba665SWarner Losh **/ 601*0d1ba665SWarner Losh RETURN_STATUS 602*0d1ba665SWarner Losh EFIAPI 603*0d1ba665SWarner Losh UnicodeValueToStringS ( 604*0d1ba665SWarner Losh IN OUT CHAR16 *Buffer, 605*0d1ba665SWarner Losh IN UINTN BufferSize, 606*0d1ba665SWarner Losh IN UINTN Flags, 607*0d1ba665SWarner Losh IN INT64 Value, 608*0d1ba665SWarner Losh IN UINTN Width 609*0d1ba665SWarner Losh ); 610*0d1ba665SWarner Losh 611*0d1ba665SWarner Losh /** 612*0d1ba665SWarner Losh Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated 613*0d1ba665SWarner Losh ASCII format string and a VA_LIST argument list. 614*0d1ba665SWarner Losh 615*0d1ba665SWarner Losh This function is similar as vsnprintf_s defined in C11. 616*0d1ba665SWarner Losh 617*0d1ba665SWarner Losh Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer 618*0d1ba665SWarner Losh and BufferSize. 619*0d1ba665SWarner Losh The ASCII string is produced by parsing the format string specified by FormatString. 620*0d1ba665SWarner Losh Arguments are pulled from the variable argument list specified by Marker based on 621*0d1ba665SWarner Losh the contents of the format string. 622*0d1ba665SWarner Losh The number of ASCII characters in the produced output buffer is returned not including 623*0d1ba665SWarner Losh the Null-terminator. 624*0d1ba665SWarner Losh 625*0d1ba665SWarner Losh If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 626*0d1ba665SWarner Losh unmodified and 0 is returned. 627*0d1ba665SWarner Losh If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is 628*0d1ba665SWarner Losh unmodified and 0 is returned. 629*0d1ba665SWarner Losh If PcdMaximumAsciiStringLength is not zero, and BufferSize > 630*0d1ba665SWarner Losh (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer 631*0d1ba665SWarner Losh is unmodified and 0 is returned. 632*0d1ba665SWarner Losh If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than 633*0d1ba665SWarner Losh PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then 634*0d1ba665SWarner Losh ASSERT(). Also, the output buffer is unmodified and 0 is returned. 635*0d1ba665SWarner Losh 636*0d1ba665SWarner Losh If BufferSize is 0, then no output buffer is produced and 0 is returned. 637*0d1ba665SWarner Losh 638*0d1ba665SWarner Losh @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated 639*0d1ba665SWarner Losh ASCII string. 640*0d1ba665SWarner Losh @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. 641*0d1ba665SWarner Losh @param FormatString A Null-terminated ASCII format string. 642*0d1ba665SWarner Losh @param Marker VA_LIST marker for the variable argument list. 643*0d1ba665SWarner Losh 644*0d1ba665SWarner Losh @return The number of ASCII characters in the produced output buffer not including the 645*0d1ba665SWarner Losh Null-terminator. 646*0d1ba665SWarner Losh 647*0d1ba665SWarner Losh **/ 648*0d1ba665SWarner Losh UINTN 649*0d1ba665SWarner Losh EFIAPI 650*0d1ba665SWarner Losh AsciiVSPrint ( 651*0d1ba665SWarner Losh OUT CHAR8 *StartOfBuffer, 652*0d1ba665SWarner Losh IN UINTN BufferSize, 653*0d1ba665SWarner Losh IN CONST CHAR8 *FormatString, 654*0d1ba665SWarner Losh IN VA_LIST Marker 655*0d1ba665SWarner Losh ); 656*0d1ba665SWarner Losh 657*0d1ba665SWarner Losh /** 658*0d1ba665SWarner Losh Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated 659*0d1ba665SWarner Losh ASCII format string and a BASE_LIST argument list. 660*0d1ba665SWarner Losh 661*0d1ba665SWarner Losh Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer 662*0d1ba665SWarner Losh and BufferSize. 663*0d1ba665SWarner Losh The ASCII string is produced by parsing the format string specified by FormatString. 664*0d1ba665SWarner Losh Arguments are pulled from the variable argument list specified by Marker based on 665*0d1ba665SWarner Losh the contents of the format string. 666*0d1ba665SWarner Losh The number of ASCII characters in the produced output buffer is returned not including 667*0d1ba665SWarner Losh the Null-terminator. 668*0d1ba665SWarner Losh 669*0d1ba665SWarner Losh If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 670*0d1ba665SWarner Losh unmodified and 0 is returned. 671*0d1ba665SWarner Losh If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is 672*0d1ba665SWarner Losh unmodified and 0 is returned. 673*0d1ba665SWarner Losh If PcdMaximumAsciiStringLength is not zero, and BufferSize > 674*0d1ba665SWarner Losh (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer 675*0d1ba665SWarner Losh is unmodified and 0 is returned. 676*0d1ba665SWarner Losh If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than 677*0d1ba665SWarner Losh PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then 678*0d1ba665SWarner Losh ASSERT(). Also, the output buffer is unmodified and 0 is returned. 679*0d1ba665SWarner Losh 680*0d1ba665SWarner Losh If BufferSize is 0, then no output buffer is produced and 0 is returned. 681*0d1ba665SWarner Losh 682*0d1ba665SWarner Losh @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated 683*0d1ba665SWarner Losh ASCII string. 684*0d1ba665SWarner Losh @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. 685*0d1ba665SWarner Losh @param FormatString A Null-terminated ASCII format string. 686*0d1ba665SWarner Losh @param Marker BASE_LIST marker for the variable argument list. 687*0d1ba665SWarner Losh 688*0d1ba665SWarner Losh @return The number of ASCII characters in the produced output buffer not including the 689*0d1ba665SWarner Losh Null-terminator. 690*0d1ba665SWarner Losh 691*0d1ba665SWarner Losh **/ 692*0d1ba665SWarner Losh UINTN 693*0d1ba665SWarner Losh EFIAPI 694*0d1ba665SWarner Losh AsciiBSPrint ( 695*0d1ba665SWarner Losh OUT CHAR8 *StartOfBuffer, 696*0d1ba665SWarner Losh IN UINTN BufferSize, 697*0d1ba665SWarner Losh IN CONST CHAR8 *FormatString, 698*0d1ba665SWarner Losh IN BASE_LIST Marker 699*0d1ba665SWarner Losh ); 700*0d1ba665SWarner Losh 701*0d1ba665SWarner Losh /** 702*0d1ba665SWarner Losh Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated 703*0d1ba665SWarner Losh ASCII format string and variable argument list. 704*0d1ba665SWarner Losh 705*0d1ba665SWarner Losh This function is similar as snprintf_s defined in C11. 706*0d1ba665SWarner Losh 707*0d1ba665SWarner Losh Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer 708*0d1ba665SWarner Losh and BufferSize. 709*0d1ba665SWarner Losh The ASCII string is produced by parsing the format string specified by FormatString. 710*0d1ba665SWarner Losh Arguments are pulled from the variable argument list based on the contents of the 711*0d1ba665SWarner Losh format string. 712*0d1ba665SWarner Losh The number of ASCII characters in the produced output buffer is returned not including 713*0d1ba665SWarner Losh the Null-terminator. 714*0d1ba665SWarner Losh 715*0d1ba665SWarner Losh If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 716*0d1ba665SWarner Losh unmodified and 0 is returned. 717*0d1ba665SWarner Losh If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is 718*0d1ba665SWarner Losh unmodified and 0 is returned. 719*0d1ba665SWarner Losh If PcdMaximumAsciiStringLength is not zero, and BufferSize > 720*0d1ba665SWarner Losh (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer 721*0d1ba665SWarner Losh is unmodified and 0 is returned. 722*0d1ba665SWarner Losh If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than 723*0d1ba665SWarner Losh PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then 724*0d1ba665SWarner Losh ASSERT(). Also, the output buffer is unmodified and 0 is returned. 725*0d1ba665SWarner Losh 726*0d1ba665SWarner Losh If BufferSize is 0, then no output buffer is produced and 0 is returned. 727*0d1ba665SWarner Losh 728*0d1ba665SWarner Losh @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated 729*0d1ba665SWarner Losh ASCII string. 730*0d1ba665SWarner Losh @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. 731*0d1ba665SWarner Losh @param FormatString A Null-terminated ASCII format string. 732*0d1ba665SWarner Losh @param ... Variable argument list whose contents are accessed based on the 733*0d1ba665SWarner Losh format string specified by FormatString. 734*0d1ba665SWarner Losh 735*0d1ba665SWarner Losh @return The number of ASCII characters in the produced output buffer not including the 736*0d1ba665SWarner Losh Null-terminator. 737*0d1ba665SWarner Losh 738*0d1ba665SWarner Losh **/ 739*0d1ba665SWarner Losh UINTN 740*0d1ba665SWarner Losh EFIAPI 741*0d1ba665SWarner Losh AsciiSPrint ( 742*0d1ba665SWarner Losh OUT CHAR8 *StartOfBuffer, 743*0d1ba665SWarner Losh IN UINTN BufferSize, 744*0d1ba665SWarner Losh IN CONST CHAR8 *FormatString, 745*0d1ba665SWarner Losh ... 746*0d1ba665SWarner Losh ); 747*0d1ba665SWarner Losh 748*0d1ba665SWarner Losh /** 749*0d1ba665SWarner Losh Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated 750*0d1ba665SWarner Losh Unicode format string and a VA_LIST argument list. 751*0d1ba665SWarner Losh 752*0d1ba665SWarner Losh This function is similar as vsnprintf_s defined in C11. 753*0d1ba665SWarner Losh 754*0d1ba665SWarner Losh Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer 755*0d1ba665SWarner Losh and BufferSize. 756*0d1ba665SWarner Losh The ASCII string is produced by parsing the format string specified by FormatString. 757*0d1ba665SWarner Losh Arguments are pulled from the variable argument list specified by Marker based on 758*0d1ba665SWarner Losh the contents of the format string. 759*0d1ba665SWarner Losh The number of ASCII characters in the produced output buffer is returned not including 760*0d1ba665SWarner Losh the Null-terminator. 761*0d1ba665SWarner Losh 762*0d1ba665SWarner Losh If FormatString is not aligned on a 16-bit boundary, then ASSERT(). 763*0d1ba665SWarner Losh 764*0d1ba665SWarner Losh If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 765*0d1ba665SWarner Losh unmodified and 0 is returned. 766*0d1ba665SWarner Losh If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is 767*0d1ba665SWarner Losh unmodified and 0 is returned. 768*0d1ba665SWarner Losh If PcdMaximumAsciiStringLength is not zero, and BufferSize > 769*0d1ba665SWarner Losh (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer 770*0d1ba665SWarner Losh is unmodified and 0 is returned. 771*0d1ba665SWarner Losh If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 772*0d1ba665SWarner Losh PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then 773*0d1ba665SWarner Losh ASSERT(). Also, the output buffer is unmodified and 0 is returned. 774*0d1ba665SWarner Losh 775*0d1ba665SWarner Losh If BufferSize is 0, then no output buffer is produced and 0 is returned. 776*0d1ba665SWarner Losh 777*0d1ba665SWarner Losh @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated 778*0d1ba665SWarner Losh ASCII string. 779*0d1ba665SWarner Losh @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. 780*0d1ba665SWarner Losh @param FormatString A Null-terminated Unicode format string. 781*0d1ba665SWarner Losh @param Marker VA_LIST marker for the variable argument list. 782*0d1ba665SWarner Losh 783*0d1ba665SWarner Losh @return The number of ASCII characters in the produced output buffer not including the 784*0d1ba665SWarner Losh Null-terminator. 785*0d1ba665SWarner Losh 786*0d1ba665SWarner Losh **/ 787*0d1ba665SWarner Losh UINTN 788*0d1ba665SWarner Losh EFIAPI 789*0d1ba665SWarner Losh AsciiVSPrintUnicodeFormat ( 790*0d1ba665SWarner Losh OUT CHAR8 *StartOfBuffer, 791*0d1ba665SWarner Losh IN UINTN BufferSize, 792*0d1ba665SWarner Losh IN CONST CHAR16 *FormatString, 793*0d1ba665SWarner Losh IN VA_LIST Marker 794*0d1ba665SWarner Losh ); 795*0d1ba665SWarner Losh 796*0d1ba665SWarner Losh /** 797*0d1ba665SWarner Losh Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated 798*0d1ba665SWarner Losh Unicode format string and a BASE_LIST argument list. 799*0d1ba665SWarner Losh 800*0d1ba665SWarner Losh Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer 801*0d1ba665SWarner Losh and BufferSize. 802*0d1ba665SWarner Losh The ASCII string is produced by parsing the format string specified by FormatString. 803*0d1ba665SWarner Losh Arguments are pulled from the variable argument list specified by Marker based on 804*0d1ba665SWarner Losh the contents of the format string. 805*0d1ba665SWarner Losh The number of ASCII characters in the produced output buffer is returned not including 806*0d1ba665SWarner Losh the Null-terminator. 807*0d1ba665SWarner Losh 808*0d1ba665SWarner Losh If FormatString is not aligned on a 16-bit boundary, then ASSERT(). 809*0d1ba665SWarner Losh 810*0d1ba665SWarner Losh If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 811*0d1ba665SWarner Losh unmodified and 0 is returned. 812*0d1ba665SWarner Losh If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is 813*0d1ba665SWarner Losh unmodified and 0 is returned. 814*0d1ba665SWarner Losh If PcdMaximumAsciiStringLength is not zero, and BufferSize > 815*0d1ba665SWarner Losh (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer 816*0d1ba665SWarner Losh is unmodified and 0 is returned. 817*0d1ba665SWarner Losh If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 818*0d1ba665SWarner Losh PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then 819*0d1ba665SWarner Losh ASSERT(). Also, the output buffer is unmodified and 0 is returned. 820*0d1ba665SWarner Losh 821*0d1ba665SWarner Losh If BufferSize is 0, then no output buffer is produced and 0 is returned. 822*0d1ba665SWarner Losh 823*0d1ba665SWarner Losh @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated 824*0d1ba665SWarner Losh ASCII string. 825*0d1ba665SWarner Losh @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. 826*0d1ba665SWarner Losh @param FormatString A Null-terminated Unicode format string. 827*0d1ba665SWarner Losh @param Marker BASE_LIST marker for the variable argument list. 828*0d1ba665SWarner Losh 829*0d1ba665SWarner Losh @return The number of ASCII characters in the produced output buffer not including the 830*0d1ba665SWarner Losh Null-terminator. 831*0d1ba665SWarner Losh 832*0d1ba665SWarner Losh **/ 833*0d1ba665SWarner Losh UINTN 834*0d1ba665SWarner Losh EFIAPI 835*0d1ba665SWarner Losh AsciiBSPrintUnicodeFormat ( 836*0d1ba665SWarner Losh OUT CHAR8 *StartOfBuffer, 837*0d1ba665SWarner Losh IN UINTN BufferSize, 838*0d1ba665SWarner Losh IN CONST CHAR16 *FormatString, 839*0d1ba665SWarner Losh IN BASE_LIST Marker 840*0d1ba665SWarner Losh ); 841*0d1ba665SWarner Losh 842*0d1ba665SWarner Losh /** 843*0d1ba665SWarner Losh Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated 844*0d1ba665SWarner Losh Unicode format string and variable argument list. 845*0d1ba665SWarner Losh 846*0d1ba665SWarner Losh This function is similar as snprintf_s defined in C11. 847*0d1ba665SWarner Losh 848*0d1ba665SWarner Losh Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer 849*0d1ba665SWarner Losh and BufferSize. 850*0d1ba665SWarner Losh The ASCII string is produced by parsing the format string specified by FormatString. 851*0d1ba665SWarner Losh Arguments are pulled from the variable argument list based on the contents of the 852*0d1ba665SWarner Losh format string. 853*0d1ba665SWarner Losh The number of ASCII characters in the produced output buffer is returned not including 854*0d1ba665SWarner Losh the Null-terminator. 855*0d1ba665SWarner Losh 856*0d1ba665SWarner Losh If FormatString is not aligned on a 16-bit boundary, then ASSERT(). 857*0d1ba665SWarner Losh 858*0d1ba665SWarner Losh If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is 859*0d1ba665SWarner Losh unmodified and 0 is returned. 860*0d1ba665SWarner Losh If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is 861*0d1ba665SWarner Losh unmodified and 0 is returned. 862*0d1ba665SWarner Losh If PcdMaximumAsciiStringLength is not zero, and BufferSize > 863*0d1ba665SWarner Losh (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer 864*0d1ba665SWarner Losh is unmodified and 0 is returned. 865*0d1ba665SWarner Losh If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than 866*0d1ba665SWarner Losh PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then 867*0d1ba665SWarner Losh ASSERT(). Also, the output buffer is unmodified and 0 is returned. 868*0d1ba665SWarner Losh 869*0d1ba665SWarner Losh If BufferSize is 0, then no output buffer is produced and 0 is returned. 870*0d1ba665SWarner Losh 871*0d1ba665SWarner Losh @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated 872*0d1ba665SWarner Losh ASCII string. 873*0d1ba665SWarner Losh @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer. 874*0d1ba665SWarner Losh @param FormatString A Null-terminated Unicode format string. 875*0d1ba665SWarner Losh @param ... Variable argument list whose contents are accessed based on the 876*0d1ba665SWarner Losh format string specified by FormatString. 877*0d1ba665SWarner Losh 878*0d1ba665SWarner Losh @return The number of ASCII characters in the produced output buffer not including the 879*0d1ba665SWarner Losh Null-terminator. 880*0d1ba665SWarner Losh 881*0d1ba665SWarner Losh **/ 882*0d1ba665SWarner Losh UINTN 883*0d1ba665SWarner Losh EFIAPI 884*0d1ba665SWarner Losh AsciiSPrintUnicodeFormat ( 885*0d1ba665SWarner Losh OUT CHAR8 *StartOfBuffer, 886*0d1ba665SWarner Losh IN UINTN BufferSize, 887*0d1ba665SWarner Losh IN CONST CHAR16 *FormatString, 888*0d1ba665SWarner Losh ... 889*0d1ba665SWarner Losh ); 890*0d1ba665SWarner Losh 891*0d1ba665SWarner Losh #ifndef DISABLE_NEW_DEPRECATED_INTERFACES 892*0d1ba665SWarner Losh 893*0d1ba665SWarner Losh /** 894*0d1ba665SWarner Losh [ATTENTION] This function is deprecated for security reason. 895*0d1ba665SWarner Losh 896*0d1ba665SWarner Losh Converts a decimal value to a Null-terminated ASCII string. 897*0d1ba665SWarner Losh 898*0d1ba665SWarner Losh Converts the decimal number specified by Value to a Null-terminated ASCII string 899*0d1ba665SWarner Losh specified by Buffer containing at most Width characters. No padding of spaces 900*0d1ba665SWarner Losh is ever performed. 901*0d1ba665SWarner Losh If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed. 902*0d1ba665SWarner Losh The number of ASCII characters in Buffer is returned, not including the Null-terminator. 903*0d1ba665SWarner Losh If the conversion contains more than Width characters, then only the first Width 904*0d1ba665SWarner Losh characters are returned, and the total number of characters required to perform 905*0d1ba665SWarner Losh the conversion is returned. 906*0d1ba665SWarner Losh Additional conversion parameters are specified in Flags. 907*0d1ba665SWarner Losh The Flags bit LEFT_JUSTIFY is always ignored. 908*0d1ba665SWarner Losh All conversions are left justified in Buffer. 909*0d1ba665SWarner Losh If Width is 0, PREFIX_ZERO is ignored in Flags. 910*0d1ba665SWarner Losh If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas 911*0d1ba665SWarner Losh are inserted every 3rd digit starting from the right. 912*0d1ba665SWarner Losh If RADIX_HEX is set in Flags, then the output buffer will be 913*0d1ba665SWarner Losh formatted in hexadecimal format. 914*0d1ba665SWarner Losh If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'. 915*0d1ba665SWarner Losh If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, 916*0d1ba665SWarner Losh then Buffer is padded with '0' characters so the combination of the optional '-' 917*0d1ba665SWarner Losh sign character, '0' characters, digit characters for Value, and the Null-terminator 918*0d1ba665SWarner Losh add up to Width characters. 919*0d1ba665SWarner Losh 920*0d1ba665SWarner Losh If Buffer is NULL, then ASSERT(). 921*0d1ba665SWarner Losh If unsupported bits are set in Flags, then ASSERT(). 922*0d1ba665SWarner Losh If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT(). 923*0d1ba665SWarner Losh If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT() 924*0d1ba665SWarner Losh 925*0d1ba665SWarner Losh @param Buffer A pointer to the output buffer for the produced Null-terminated 926*0d1ba665SWarner Losh ASCII string. 927*0d1ba665SWarner Losh @param Flags The bitmask of flags that specify left justification, zero pad, and commas. 928*0d1ba665SWarner Losh @param Value The 64-bit signed value to convert to a string. 929*0d1ba665SWarner Losh @param Width The maximum number of ASCII characters to place in Buffer, not including 930*0d1ba665SWarner Losh the Null-terminator. 931*0d1ba665SWarner Losh 932*0d1ba665SWarner Losh @return The number of ASCII characters in Buffer, not including the Null-terminator. 933*0d1ba665SWarner Losh 934*0d1ba665SWarner Losh **/ 935*0d1ba665SWarner Losh UINTN 936*0d1ba665SWarner Losh EFIAPI 937*0d1ba665SWarner Losh AsciiValueToString ( 938*0d1ba665SWarner Losh OUT CHAR8 *Buffer, 939*0d1ba665SWarner Losh IN UINTN Flags, 940*0d1ba665SWarner Losh IN INT64 Value, 941*0d1ba665SWarner Losh IN UINTN Width 942*0d1ba665SWarner Losh ); 943*0d1ba665SWarner Losh 944*0d1ba665SWarner Losh #endif 945*0d1ba665SWarner Losh 946*0d1ba665SWarner Losh /** 947*0d1ba665SWarner Losh Converts a decimal value to a Null-terminated Ascii string. 948*0d1ba665SWarner Losh 949*0d1ba665SWarner Losh Converts the decimal number specified by Value to a Null-terminated Ascii 950*0d1ba665SWarner Losh string specified by Buffer containing at most Width characters. No padding of 951*0d1ba665SWarner Losh spaces is ever performed. If Width is 0 then a width of 952*0d1ba665SWarner Losh MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than 953*0d1ba665SWarner Losh Width characters, then only the first Width characters are placed in Buffer. 954*0d1ba665SWarner Losh Additional conversion parameters are specified in Flags. 955*0d1ba665SWarner Losh 956*0d1ba665SWarner Losh The Flags bit LEFT_JUSTIFY is always ignored. 957*0d1ba665SWarner Losh All conversions are left justified in Buffer. 958*0d1ba665SWarner Losh If Width is 0, PREFIX_ZERO is ignored in Flags. 959*0d1ba665SWarner Losh If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and 960*0d1ba665SWarner Losh commas are inserted every 3rd digit starting from the right. 961*0d1ba665SWarner Losh If RADIX_HEX is set in Flags, then the output buffer will be formatted in 962*0d1ba665SWarner Losh hexadecimal format. 963*0d1ba665SWarner Losh If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in 964*0d1ba665SWarner Losh Buffer is a '-'. 965*0d1ba665SWarner Losh If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then 966*0d1ba665SWarner Losh Buffer is padded with '0' characters so the combination of the optional '-' 967*0d1ba665SWarner Losh sign character, '0' characters, digit characters for Value, and the 968*0d1ba665SWarner Losh Null-terminator add up to Width characters. 969*0d1ba665SWarner Losh 970*0d1ba665SWarner Losh If Buffer is not aligned on a 16-bit boundary, then ASSERT(). 971*0d1ba665SWarner Losh If an error would be returned, then the function will also ASSERT(). 972*0d1ba665SWarner Losh 973*0d1ba665SWarner Losh @param Buffer The pointer to the output buffer for the produced 974*0d1ba665SWarner Losh Null-terminated Ascii string. 975*0d1ba665SWarner Losh @param BufferSize The size of Buffer in bytes, including the 976*0d1ba665SWarner Losh Null-terminator. 977*0d1ba665SWarner Losh @param Flags The bitmask of flags that specify left justification, 978*0d1ba665SWarner Losh zero pad, and commas. 979*0d1ba665SWarner Losh @param Value The 64-bit signed value to convert to a string. 980*0d1ba665SWarner Losh @param Width The maximum number of Ascii characters to place in 981*0d1ba665SWarner Losh Buffer, not including the Null-terminator. 982*0d1ba665SWarner Losh 983*0d1ba665SWarner Losh @retval RETURN_SUCCESS The decimal value is converted. 984*0d1ba665SWarner Losh @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted 985*0d1ba665SWarner Losh value. 986*0d1ba665SWarner Losh @retval RETURN_INVALID_PARAMETER If Buffer is NULL. 987*0d1ba665SWarner Losh If PcdMaximumAsciiStringLength is not 988*0d1ba665SWarner Losh zero, and BufferSize is greater than 989*0d1ba665SWarner Losh PcdMaximumAsciiStringLength. 990*0d1ba665SWarner Losh If unsupported bits are set in Flags. 991*0d1ba665SWarner Losh If both COMMA_TYPE and RADIX_HEX are set in 992*0d1ba665SWarner Losh Flags. 993*0d1ba665SWarner Losh If Width >= MAXIMUM_VALUE_CHARACTERS. 994*0d1ba665SWarner Losh 995*0d1ba665SWarner Losh **/ 996*0d1ba665SWarner Losh RETURN_STATUS 997*0d1ba665SWarner Losh EFIAPI 998*0d1ba665SWarner Losh AsciiValueToStringS ( 999*0d1ba665SWarner Losh IN OUT CHAR8 *Buffer, 1000*0d1ba665SWarner Losh IN UINTN BufferSize, 1001*0d1ba665SWarner Losh IN UINTN Flags, 1002*0d1ba665SWarner Losh IN INT64 Value, 1003*0d1ba665SWarner Losh IN UINTN Width 1004*0d1ba665SWarner Losh ); 1005*0d1ba665SWarner Losh 1006*0d1ba665SWarner Losh /** 1007*0d1ba665SWarner Losh Returns the number of characters that would be produced by if the formatted 1008*0d1ba665SWarner Losh output were produced not including the Null-terminator. 1009*0d1ba665SWarner Losh 1010*0d1ba665SWarner Losh If FormatString is not aligned on a 16-bit boundary, then ASSERT(). 1011*0d1ba665SWarner Losh 1012*0d1ba665SWarner Losh If FormatString is NULL, then ASSERT() and 0 is returned. 1013*0d1ba665SWarner Losh If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more 1014*0d1ba665SWarner Losh than PcdMaximumUnicodeStringLength Unicode characters not including the 1015*0d1ba665SWarner Losh Null-terminator, then ASSERT() and 0 is returned. 1016*0d1ba665SWarner Losh 1017*0d1ba665SWarner Losh @param[in] FormatString A Null-terminated Unicode format string. 1018*0d1ba665SWarner Losh @param[in] Marker VA_LIST marker for the variable argument list. 1019*0d1ba665SWarner Losh 1020*0d1ba665SWarner Losh @return The number of characters that would be produced, not including the 1021*0d1ba665SWarner Losh Null-terminator. 1022*0d1ba665SWarner Losh **/ 1023*0d1ba665SWarner Losh UINTN 1024*0d1ba665SWarner Losh EFIAPI 1025*0d1ba665SWarner Losh SPrintLength ( 1026*0d1ba665SWarner Losh IN CONST CHAR16 *FormatString, 1027*0d1ba665SWarner Losh IN VA_LIST Marker 1028*0d1ba665SWarner Losh ); 1029*0d1ba665SWarner Losh 1030*0d1ba665SWarner Losh /** 1031*0d1ba665SWarner Losh Returns the number of characters that would be produced by if the formatted 1032*0d1ba665SWarner Losh output were produced not including the Null-terminator. 1033*0d1ba665SWarner Losh 1034*0d1ba665SWarner Losh If FormatString is NULL, then ASSERT() and 0 is returned. 1035*0d1ba665SWarner Losh If PcdMaximumAsciiStringLength is not zero, and FormatString contains more 1036*0d1ba665SWarner Losh than PcdMaximumAsciiStringLength Ascii characters not including the 1037*0d1ba665SWarner Losh Null-terminator, then ASSERT() and 0 is returned. 1038*0d1ba665SWarner Losh 1039*0d1ba665SWarner Losh @param[in] FormatString A Null-terminated ASCII format string. 1040*0d1ba665SWarner Losh @param[in] Marker VA_LIST marker for the variable argument list. 1041*0d1ba665SWarner Losh 1042*0d1ba665SWarner Losh @return The number of characters that would be produced, not including the 1043*0d1ba665SWarner Losh Null-terminator. 1044*0d1ba665SWarner Losh **/ 1045*0d1ba665SWarner Losh UINTN 1046*0d1ba665SWarner Losh EFIAPI 1047*0d1ba665SWarner Losh SPrintLengthAsciiFormat ( 1048*0d1ba665SWarner Losh IN CONST CHAR8 *FormatString, 1049*0d1ba665SWarner Losh IN VA_LIST Marker 1050*0d1ba665SWarner Losh ); 1051*0d1ba665SWarner Losh 1052*0d1ba665SWarner Losh #endif 1053