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