]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/PrintLib.h
Remove the work-around in DevicePathLib to judge the end of device path node type.
[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
50a64e5b 5Copyright (c) 2006 - 2008, Intel Corporation\r
6All rights reserved. This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The 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
18 text and argument descriptors can be mixed. A normal text character '\n' must \r
19 always be converted to '\n\r'. This does not follow the ANSI C standard for \r
20 sprint(). The format of argument descriptors is described below. The ANSI C \r
21 standard for sprint() has been followed for some of the format types, and has \r
22 not been followed for others. The exceptions are noted below.\r
23\r
24 %[flags][width][.precision]type\r
25\r
26 [flags]:\r
40731047 27 - - \r
b7ca8783 28 - The field is left justified. If not flag is not specified, then the \r
29 field is right justified.\r
40731047 30 - space \r
b7ca8783 31 - Prefix a space character to a number. Only valid for types X, x, and d.\r
40731047 32 - + \r
b7ca8783 33 - Prefix a plus character to a number. Only valid for types X, x, and d. \r
34 If both space and + are specified, then space is ignored.\r
35 - 0\r
36 - Pad with 0 characters to the left of a number. Only valid for types \r
37 X, x, and d.\r
38 - ,\r
39 - Place a comma every 3rd digit of the number. Only valid for type d.\r
40 If 0 is also specified, then 0 is ignored.\r
41 - L, l\r
42 - The number being printed is a UINT64. Only valid for types X, x, and d.\r
43 If this flag is not specified, then the number being printed is a int.\r
44 - NOTE: All invalid flags are ignored.\r
45\r
46 [width]:\r
47\r
48 - *\r
49 - The width of the field is specified by a UINTN argument in the \r
50 argument list.\r
51 - number\r
52 - The number specified as a decimal value represents the width of \r
53 the field.\r
54 - NOTE: If [width] is not specified, then a field width of 0 is assumed.\r
55\r
56 [.precision]:\r
57\r
58 - *\r
59 - The prevision of the field is specified by a UINTN argument in the \r
60 argument list.\r
61 - number\r
62 - The number specified as a decimal value represents the precision of \r
63 the field.\r
64 - NOTE: If [.precision] is not specified, then a precision of 0 is assumed.\r
65\r
66 type:\r
67\r
68 - %\r
69 - Print a %%.\r
70 - c\r
71 - The argument is a Unicode character. ASCII characters can be printed \r
72 using this type too by making sure bits 8..15 of the argument are set to 0.\r
73 - x\r
74 - The argument is a hexadecimal number. The characters used are 0..9 and \r
c3d4e543 75 A..F. If the flag 'L' is not specified, then the argument is assumed \r
b7ca8783 76 to be an int. This does not follow ANSI C.\r
77 - X\r
78 - The argument is a hexadecimal number and the number is padded with \r
52707978 79 zeros. This is equivalent to a format string of "0x". If the flag \r
b7ca8783 80 'L' is not specified, then the argument is assumed to be an int. \r
81 This does not follow ANSI C.\r
82 - d\r
83 - The argument is a decimal number. If the flag 'L' is not specified, \r
84 then the argument is assumed to be an int. \r
85 - p\r
86 - The argument is a pointer that is a (VOID *), and it is printed as a \r
87 hexadecimal number The characters used are 0..9 and A..F.\r
88 - a\r
89 - The argument is a pointer to an ASCII string. \r
90 This does not follow ANSI C.\r
91 - S, s\r
92 - The argument is a pointer to a Unicode string. \r
93 This does not follow ANSI C.\r
94 - g\r
95 - The argument is a pointer to a GUID structure. The GUID is printed \r
96 in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX. \r
97 This does not follow ANSI C.\r
98 - t\r
99 - The argument is a pointer to an EFI_TIME structure. The time and \r
c3d4e543 100 date are printed in the format "mm/dd/yyyy hh:mm" where mm is the \r
b7ca8783 101 month zero padded, dd is the day zero padded, yyyy is the year zero \r
102 padded, hh is the hour zero padded, and mm is minutes zero padded. \r
103 This does not follow ANSI C. \r
104 - r\r
105 - The argument is a RETURN_STATUS value. This value is converted to \r
106 a string following the table below. This does not follow ANSI C. \r
107 - RETURN_SUCCESS \r
108 - "Success"\r
109 - RETURN_LOAD_ERROR \r
110 - "Load Error"\r
111 - RETURN_INVALID_PARAMETER \r
112 - "Invalid Parameter"\r
113 - RETURN_UNSUPPORTED \r
114 - "Unsupported"\r
115 - RETURN_BAD_BUFFER_SIZE \r
116 - "Bad Buffer Size"\r
117 - RETURN_BUFFER_TOO_SMALL \r
118 - "Buffer Too Small"\r
119 - RETURN_NOT_READY \r
120 - "Not Ready"\r
121 - RETURN_DEVICE_ERROR \r
122 - "Device Error"\r
123 - RETURN_WRITE_PROTECTED \r
124 - "Write Protected"\r
125 - RETURN_OUT_OF_RESOURCES \r
126 - "Out of Resources"\r
127 - RETURN_VOLUME_CORRUPTED \r
128 - "Volume Corrupt"\r
129 - RETURN_VOLUME_FULL \r
130 - "Volume Full"\r
131 - RETURN_NO_MEDIA \r
132 - "No Media"\r
133 - RETURN_MEDIA_CHANGED \r
134 - "Media changed"\r
135 - RETURN_NOT_FOUND \r
136 - "Not Found"\r
137 - RETURN_ACCESS_DENIED \r
138 - "Access Denied"\r
139 - RETURN_NO_RESPONSE \r
140 - "No Response"\r
141 - RETURN_NO_MAPPING \r
142 - "No mapping"\r
143 - RETURN_TIMEOUT \r
144 - "Time out"\r
145 - RETURN_NOT_STARTED \r
146 - "Not started"\r
147 - RETURN_ALREADY_STARTED \r
148 - "Already started"\r
149 - RETURN_ABORTED \r
150 - "Aborted"\r
151 - RETURN_ICMP_ERROR \r
152 - "ICMP Error"\r
153 - RETURN_TFTP_ERROR \r
154 - "TFTP Error"\r
155 - RETURN_PROTOCOL_ERROR \r
156 - "Protocol Error"\r
157 - RETURN_WARN_UNKNOWN_GLYPH \r
158 - "Warning Unknown Glyph"\r
159 - RETURN_WARN_DELETE_FAILURE \r
160 - "Warning Delete Failure"\r
161 - RETURN_WARN_WRITE_FAILURE \r
162 - "Warning Write Failure"\r
163 - RETURN_WARN_BUFFER_TOO_SMALL \r
164 - "Warning Buffer Too Small"\r
165\r
488ee641 166**/\r
167\r
168#ifndef __PRINT_LIB_H__\r
169#define __PRINT_LIB_H__\r
170\r
171///\r
172/// Define the maximum number of characters that are required to\r
a9b896f4 173/// encode a decimal, hexadecimal, GUID, or TIME value with a NULL \r
488ee641 174/// terminator.\r
175/// \r
176/// Maximum Length Decimal String = 28\r
177/// "-9,223,372,036,854,775,808"\r
a9b896f4 178/// Maximum Length Hexadecimal String = 17\r
488ee641 179/// "FFFFFFFFFFFFFFFF"\r
180/// Maximum Length GUID = 37\r
181/// "00000000-0000-0000-0000-000000000000"\r
182/// Maximum Length TIME = 18\r
183/// "12/12/2006 12:12"\r
184///\r
185#define MAXIMUM_VALUE_CHARACTERS 38\r
186\r
187///\r
188/// Flags bitmask values use in UnicodeValueToString() and \r
189/// AsciiValueToString()\r
190///\r
191#define LEFT_JUSTIFY 0x01\r
192#define COMMA_TYPE 0x08\r
193#define PREFIX_ZERO 0x20\r
194#define RADIX_HEX 0x80\r
195\r
196/**\r
197 Produces a Null-terminated Unicode string in an output buffer based on \r
198 a Null-terminated Unicode format string and a VA_LIST argument list\r
199 \r
200 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
201 and BufferSize. \r
202 The Unicode string is produced by parsing the format string specified by FormatString. \r
203 Arguments are pulled from the variable argument list specified by Marker based on the \r
204 contents of the format string. \r
205 The number of Unicode characters in the produced output buffer is returned not including\r
206 the Null-terminator.\r
207 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
208\r
209 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
210 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
211 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
212 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
213 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r
214 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
215 ASSERT().\r
216 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
217 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
218 Null-terminator, then ASSERT().\r
219\r
220 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
221 Unicode string.\r
222 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
223 @param FormatString Null-terminated Unicode format string.\r
224 @param Marker VA_LIST marker for the variable argument list.\r
225 \r
226 @return The number of Unicode characters in the produced output buffer not including the\r
227 Null-terminator.\r
228\r
229**/\r
230UINTN\r
231EFIAPI\r
232UnicodeVSPrint (\r
233 OUT CHAR16 *StartOfBuffer,\r
234 IN UINTN BufferSize,\r
235 IN CONST CHAR16 *FormatString,\r
236 IN VA_LIST Marker\r
237 );\r
238\r
239/**\r
240 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r
241 Unicode format string and variable argument list.\r
242 \r
243 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
244 and BufferSize.\r
245 The Unicode string is produced by parsing the format string specified by FormatString.\r
246 Arguments are pulled from the variable argument list based on the contents of the format string.\r
247 The number of Unicode characters in the produced output buffer is returned not including\r
248 the Null-terminator.\r
249 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
250\r
251 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
252 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
253 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
254 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
255 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r
256 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
257 ASSERT().\r
258 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
259 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
260 Null-terminator, then ASSERT().\r
261\r
262 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
263 Unicode string.\r
264 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
265 @param FormatString Null-terminated Unicode format string.\r
285010e7 266 @param ... Variable argument list whose contents are accessed based on the \r
267 format string specified by FormatString.\r
488ee641 268 \r
269 @return The number of Unicode characters in the produced output buffer not including the\r
270 Null-terminator.\r
271\r
272**/\r
273UINTN\r
274EFIAPI\r
275UnicodeSPrint (\r
276 OUT CHAR16 *StartOfBuffer,\r
277 IN UINTN BufferSize,\r
278 IN CONST CHAR16 *FormatString,\r
279 ...\r
280 );\r
281\r
282/**\r
283 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r
284 ASCII format string and a VA_LIST argument list\r
285 \r
286 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
287 and BufferSize.\r
288 The Unicode string is produced by parsing the format string specified by FormatString.\r
289 Arguments are pulled from the variable argument list specified by Marker based on the \r
290 contents of the format string.\r
291 The number of Unicode characters in the produced output buffer is returned not including\r
292 the Null-terminator.\r
293 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
294\r
295 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
296 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
297 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
298 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
299 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
300 ASSERT().\r
301 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
302 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
303 Null-terminator, then ASSERT().\r
304\r
305 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
306 Unicode string.\r
307 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
308 @param FormatString Null-terminated ASCII format string.\r
309 @param Marker VA_LIST marker for the variable argument list.\r
310 \r
311 @return The number of Unicode characters in the produced output buffer not including the\r
312 Null-terminator.\r
313\r
314**/\r
315UINTN\r
316EFIAPI\r
317UnicodeVSPrintAsciiFormat (\r
318 OUT CHAR16 *StartOfBuffer,\r
319 IN UINTN BufferSize,\r
320 IN CONST CHAR8 *FormatString,\r
321 IN VA_LIST Marker\r
322 );\r
323\r
324/**\r
325 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r
326 ASCII format string and variable argument list.\r
327 \r
328 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
329 and BufferSize.\r
330 The Unicode string is produced by parsing the format string specified by FormatString.\r
331 Arguments are pulled from the variable argument list based on the contents of the \r
332 format string.\r
333 The number of Unicode characters in the produced output buffer is returned not including\r
334 the Null-terminator.\r
335 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
336\r
337 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
338 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
339 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
340 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
341 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
342 ASSERT().\r
343 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
344 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
345 Null-terminator, then ASSERT().\r
346\r
347 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
348 Unicode string.\r
349 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
350 @param FormatString Null-terminated ASCII format string.\r
285010e7 351 @param ... Variable argument list whose contents are accessed based on the \r
352 format string specified by FormatString.\r
488ee641 353 \r
354 @return The number of Unicode characters in the produced output buffer not including the\r
355 Null-terminator.\r
356\r
357**/\r
358UINTN\r
359EFIAPI\r
360UnicodeSPrintAsciiFormat (\r
361 OUT CHAR16 *StartOfBuffer,\r
362 IN UINTN BufferSize,\r
363 IN CONST CHAR8 *FormatString,\r
364 ...\r
365 );\r
366\r
367/**\r
368 Converts a decimal value to a Null-terminated Unicode string.\r
369 \r
370 Converts the decimal number specified by Value to a Null-terminated Unicode \r
371 string specified by Buffer containing at most Width characters. No padding of spaces \r
372 is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
373 The number of Unicode characters in Buffer is returned not including the Null-terminator.\r
374 If the conversion contains more than Width characters, then only the first\r
375 Width characters are returned, and the total number of characters \r
376 required to perform the conversion is returned.\r
377 Additional conversion parameters are specified in Flags. \r
378 \r
379 The Flags bit LEFT_JUSTIFY is always ignored.\r
380 All conversions are left justified in Buffer.\r
381 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
382 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
383 are inserted every 3rd digit starting from the right.\r
384 If HEX_RADIX is set in Flags, then the output buffer will be \r
385 formatted in hexadecimal format.\r
386 If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.\r
387 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
388 then Buffer is padded with '0' characters so the combination of the optional '-' \r
389 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
390 add up to Width characters.\r
391 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r
392 If Buffer is NULL, then ASSERT().\r
393 If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
394 If unsupported bits are set in Flags, then ASSERT().\r
395 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r
396 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
397\r
398 @param Buffer Pointer to the output buffer for the produced Null-terminated\r
399 Unicode string.\r
400 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r
401 @param Value The 64-bit signed value to convert to a string.\r
402 @param Width The maximum number of Unicode characters to place in Buffer, not including\r
403 the Null-terminator.\r
404 \r
405 @return The number of Unicode characters in Buffer not including the Null-terminator.\r
406\r
407**/\r
408UINTN\r
409EFIAPI\r
410UnicodeValueToString (\r
411 IN OUT CHAR16 *Buffer,\r
412 IN UINTN Flags,\r
413 IN INT64 Value,\r
414 IN UINTN Width\r
415 );\r
416\r
417/**\r
418 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
419 ASCII format string and a VA_LIST argument list.\r
420 \r
421 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
422 and BufferSize.\r
423 The ASCII string is produced by parsing the format string specified by FormatString.\r
424 Arguments are pulled from the variable argument list specified by Marker based on \r
425 the contents of the format string.\r
426 The number of ASCII characters in the produced output buffer is returned not including\r
427 the Null-terminator.\r
428 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
429\r
430 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
431 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
432 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
433 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
434 ASSERT().\r
435 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
436 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
437 Null-terminator, then ASSERT().\r
438\r
439 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
440 ASCII string.\r
441 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
442 @param FormatString Null-terminated ASCII format string.\r
443 @param Marker VA_LIST marker for the variable argument list.\r
444 \r
445 @return The number of ASCII characters in the produced output buffer not including the\r
446 Null-terminator.\r
447\r
448**/\r
449UINTN\r
450EFIAPI\r
451AsciiVSPrint (\r
452 OUT CHAR8 *StartOfBuffer,\r
453 IN UINTN BufferSize,\r
454 IN CONST CHAR8 *FormatString,\r
455 IN VA_LIST Marker\r
456 );\r
457\r
458/**\r
459 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
460 ASCII format string and variable argument list.\r
461 \r
462 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
463 and BufferSize.\r
464 The ASCII string is produced by parsing the format string specified by FormatString.\r
465 Arguments are pulled from the variable argument list based on the contents of the \r
466 format string.\r
467 The number of ASCII characters in the produced output buffer is returned not including\r
468 the Null-terminator.\r
469 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
470\r
471 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
472 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
473 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
474 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
475 ASSERT().\r
476 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
477 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
478 Null-terminator, then ASSERT().\r
479\r
480 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
481 ASCII string.\r
482 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
483 @param FormatString Null-terminated ASCII format string.\r
285010e7 484 @param ... Variable argument list whose contents are accessed based on the \r
485 format string specified by FormatString.\r
488ee641 486 \r
487 @return The number of ASCII characters in the produced output buffer not including the\r
488 Null-terminator.\r
489\r
490**/\r
491UINTN\r
492EFIAPI\r
493AsciiSPrint (\r
494 OUT CHAR8 *StartOfBuffer,\r
495 IN UINTN BufferSize,\r
496 IN CONST CHAR8 *FormatString,\r
497 ...\r
498 );\r
499\r
500/**\r
501 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
502 Unicode format string and a VA_LIST argument list.\r
503 \r
504 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
505 and BufferSize.\r
506 The ASCII string is produced by parsing the format string specified by FormatString.\r
507 Arguments are pulled from the variable argument list specified by Marker based on \r
508 the contents of the format string.\r
509 The number of ASCII characters in the produced output buffer is returned not including\r
510 the Null-terminator.\r
511 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
512\r
513 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
514 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
515 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
516 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
517 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
518 ASSERT().\r
519 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
520 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
521 Null-terminator, then ASSERT().\r
522\r
523 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
524 ASCII string.\r
525 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
526 @param FormatString Null-terminated Unicode format string.\r
527 @param Marker VA_LIST marker for the variable argument list.\r
528 \r
529 @return The number of ASCII characters in the produced output buffer not including the\r
530 Null-terminator.\r
531\r
532**/\r
533UINTN\r
534EFIAPI\r
535AsciiVSPrintUnicodeFormat (\r
536 OUT CHAR8 *StartOfBuffer,\r
537 IN UINTN BufferSize,\r
538 IN CONST CHAR16 *FormatString,\r
539 IN VA_LIST Marker\r
540 );\r
541\r
542/**\r
543 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
544 Unicode format string and variable argument list.\r
545 \r
546 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
547 and BufferSize.\r
548 The ASCII string is produced by parsing the format string specified by FormatString.\r
549 Arguments are pulled from the variable argument list based on the contents of the \r
550 format string.\r
551 The number of ASCII characters in the produced output buffer is returned not including\r
552 the Null-terminator.\r
553 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
554\r
555 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
556 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
557 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
558 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
559 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
560 ASSERT().\r
561 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
562 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
563 Null-terminator, then ASSERT().\r
564\r
565 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
566 ASCII string.\r
567 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
568 @param FormatString Null-terminated Unicode format string.\r
285010e7 569 @param ... Variable argument list whose contents are accessed based on the \r
570 format string specified by FormatString.\r
488ee641 571 \r
572 @return The number of ASCII characters in the produced output buffer not including the\r
573 Null-terminator.\r
574\r
575**/\r
576UINTN\r
577EFIAPI\r
578AsciiSPrintUnicodeFormat (\r
579 OUT CHAR8 *StartOfBuffer,\r
580 IN UINTN BufferSize,\r
581 IN CONST CHAR16 *FormatString,\r
582 ...\r
583 );\r
584\r
585/**\r
586 Converts a decimal value to a Null-terminated ASCII string.\r
587 \r
588 Converts the decimal number specified by Value to a Null-terminated ASCII string \r
589 specified by Buffer containing at most Width characters. No padding of spaces \r
590 is ever performed.\r
591 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
592 The number of ASCII characters in Buffer is returned not including the Null-terminator.\r
593 If the conversion contains more than Width characters, then only the first Width\r
594 characters are returned, and the total number of characters required to perform\r
595 the conversion is returned.\r
596 Additional conversion parameters are specified in Flags. \r
597 The Flags bit LEFT_JUSTIFY is always ignored.\r
598 All conversions are left justified in Buffer.\r
599 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
600 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
601 are inserted every 3rd digit starting from the right.\r
602 If HEX_RADIX is set in Flags, then the output buffer will be \r
603 formatted in hexadecimal format.\r
604 If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.\r
605 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
606 then Buffer is padded with '0' characters so the combination of the optional '-' \r
607 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
608 add up to Width characters.\r
609 \r
610 If Buffer is NULL, then ASSERT().\r
611 If unsupported bits are set in Flags, then ASSERT().\r
612 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r
613 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
614\r
615 @param Buffer Pointer to the output buffer for the produced Null-terminated\r
616 ASCII string.\r
617 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r
618 @param Value The 64-bit signed value to convert to a string.\r
619 @param Width The maximum number of ASCII characters to place in Buffer, not including\r
620 the Null-terminator.\r
621 \r
622 @return The number of ASCII characters in Buffer not including the Null-terminator.\r
623\r
624**/\r
625UINTN\r
626EFIAPI\r
627AsciiValueToString (\r
58125b7a 628 OUT CHAR8 *Buffer,\r
629 IN UINTN Flags,\r
630 IN INT64 Value,\r
631 IN UINTN Width\r
488ee641 632 );\r
633\r
634#endif\r