]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Library/PrintLib.h
MdePkg: fix comment typo in DebugLib.h
[mirror_edk2.git] / MdePkg / Include / Library / PrintLib.h
... / ...
CommitLineData
1/** @file\r
2 Provides services to print a formatted string to a buffer. All combinations of\r
3 Unicode and ASCII strings are supported.\r
4\r
5Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
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
10\r
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
13\r
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. 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
30\r
31 %[flags][width][.precision]type\r
32\r
33 [flags]:\r
34 - - \r
35 - The field is left justified. If not flag is not specified, then the \r
36 field is right justified.\r
37 - space \r
38 - Prefix a space character to a number. Only valid for types X, x, and d.\r
39 - + \r
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
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
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
66 - The precision of the field is specified by a UINTN argument in the \r
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
81 - The argument is an unsigned hexadecimal number. The characters used are 0..9 and \r
82 A..F. If the flag 'L' is not specified, then the argument is assumed \r
83 to be size int. This does not follow ANSI C.\r
84 - X\r
85 - The argument is an unsigned hexadecimal number and the number is padded with \r
86 zeros. This is equivalent to a format string of "0x". If the flag \r
87 'L' is not specified, then the argument is assumed to be size int. \r
88 This does not follow ANSI C.\r
89 - d\r
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
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
95 - p\r
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
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
110 date are printed in the format "mm/dd/yyyy hh:mm" where mm is the \r
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
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
183/// encode with a NULL terminator a decimal, hexadecimal, GUID, \r
184/// or TIME value.\r
185/// \r
186/// Maximum Length Decimal String = 28\r
187/// "-9,223,372,036,854,775,808"\r
188/// Maximum Length Hexadecimal String = 17\r
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
207 Produces a Null-terminated Unicode string in an output buffer based on \r
208 a Null-terminated Unicode format string and a VA_LIST argument list.\r
209 \r
210 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
211 and BufferSize. \r
212 The Unicode string is produced by parsing the format string specified by FormatString. \r
213 Arguments are pulled from the variable argument list specified by Marker based on the \r
214 contents of the format string. \r
215 The number of Unicode characters in the produced output buffer is returned, not including\r
216 the Null-terminator.\r
217 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
218\r
219 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
220 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
221 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
222 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
223 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r
224 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then\r
225 ASSERT().\r
226 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
227 contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the\r
228 Null-terminator, then ASSERT().\r
229\r
230 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
231 Unicode string.\r
232 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
233 @param FormatString Null-terminated Unicode format string.\r
234 @param Marker VA_LIST marker for the variable argument list.\r
235 \r
236 @return The number of Unicode characters in the produced output buffer, not including the\r
237 Null-terminator.\r
238\r
239**/\r
240UINTN\r
241EFIAPI\r
242UnicodeVSPrint (\r
243 OUT CHAR16 *StartOfBuffer,\r
244 IN UINTN BufferSize,\r
245 IN CONST CHAR16 *FormatString,\r
246 IN VA_LIST Marker\r
247 );\r
248\r
249/**\r
250 Produces a Null-terminated Unicode string in an output buffer based on \r
251 a Null-terminated Unicode format string and a BASE_LIST argument list.\r
252 \r
253 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
254 and BufferSize. \r
255 The Unicode string is produced by parsing the format string specified by FormatString. \r
256 Arguments are pulled from the variable argument list specified by Marker based on the \r
257 contents of the format string. \r
258 The number of Unicode characters in the produced output buffer is returned, not including\r
259 the Null-terminator.\r
260 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
261\r
262 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
263 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
264 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
265 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
266 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r
267 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then\r
268 ASSERT().\r
269 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
270 contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the\r
271 Null-terminator, then ASSERT().\r
272\r
273 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
274 Unicode string.\r
275 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
276 @param FormatString Null-terminated Unicode format string.\r
277 @param Marker BASE_LIST marker for the variable argument list.\r
278 \r
279 @return The number of Unicode characters in the produced output buffer, not including the\r
280 Null-terminator.\r
281\r
282**/\r
283UINTN\r
284EFIAPI\r
285UnicodeBSPrint (\r
286 OUT CHAR16 *StartOfBuffer,\r
287 IN UINTN BufferSize,\r
288 IN CONST CHAR16 *FormatString,\r
289 IN BASE_LIST Marker\r
290 );\r
291\r
292/**\r
293 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r
294 Unicode format string and variable argument list.\r
295 \r
296 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
297 and BufferSize.\r
298 The Unicode string is produced by parsing the format string specified by FormatString.\r
299 Arguments are pulled from the variable argument list based on the contents of the format string.\r
300 The number of Unicode characters in the produced output buffer is returned, not including\r
301 the Null-terminator.\r
302 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
303\r
304 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
305 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
306 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
307 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
308 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r
309 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
310 ASSERT().\r
311 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
312 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
313 Null-terminator, then ASSERT().\r
314\r
315 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
316 Unicode string.\r
317 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
318 @param FormatString A null-terminated Unicode format string.\r
319 @param ... The variable argument list whose contents are accessed based on the \r
320 format string specified by FormatString.\r
321 \r
322 @return The number of Unicode characters in the produced output buffer, not including the\r
323 Null-terminator.\r
324\r
325**/\r
326UINTN\r
327EFIAPI\r
328UnicodeSPrint (\r
329 OUT CHAR16 *StartOfBuffer,\r
330 IN UINTN BufferSize,\r
331 IN CONST CHAR16 *FormatString,\r
332 ...\r
333 );\r
334\r
335/**\r
336 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r
337 ASCII format string and a VA_LIST argument list\r
338 \r
339 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
340 and BufferSize.\r
341 The Unicode string is produced by parsing the format string specified by FormatString.\r
342 Arguments are pulled from the variable argument list specified by Marker based on the \r
343 contents of the format string.\r
344 The number of Unicode characters in the produced output buffer is returned, not including\r
345 the Null-terminator.\r
346 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
347\r
348 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
349 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
350 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
351 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
352 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then\r
353 ASSERT().\r
354 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
355 contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the\r
356 Null-terminator, then ASSERT().\r
357\r
358 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
359 Unicode string.\r
360 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
361 @param FormatString A null-terminated ASCII format string.\r
362 @param Marker VA_LIST marker for the variable argument list.\r
363 \r
364 @return The number of Unicode characters in the produced output buffer not including the\r
365 Null-terminator.\r
366\r
367**/\r
368UINTN\r
369EFIAPI\r
370UnicodeVSPrintAsciiFormat (\r
371 OUT CHAR16 *StartOfBuffer,\r
372 IN UINTN BufferSize,\r
373 IN CONST CHAR8 *FormatString,\r
374 IN VA_LIST Marker\r
375 );\r
376\r
377/**\r
378 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r
379 ASCII format string and a BASE_LIST argument list\r
380 \r
381 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
382 and BufferSize.\r
383 The Unicode string is produced by parsing the format string specified by FormatString.\r
384 Arguments are pulled from the variable argument list specified by Marker based on the \r
385 contents of the format string.\r
386 The number of Unicode characters in the produced output buffer is returned, not including\r
387 the Null-terminator.\r
388 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
389\r
390 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
391 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
392 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
393 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
394 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then\r
395 ASSERT().\r
396 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
397 contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the\r
398 Null-terminator, then ASSERT().\r
399\r
400 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
401 Unicode string.\r
402 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
403 @param FormatString A null-terminated ASCII format string.\r
404 @param Marker A BASE_LIST marker for the variable argument list.\r
405 \r
406 @return The number of Unicode characters in the produced output buffer, not including the\r
407 Null-terminator.\r
408\r
409**/\r
410UINTN\r
411EFIAPI\r
412UnicodeBSPrintAsciiFormat (\r
413 OUT CHAR16 *StartOfBuffer,\r
414 IN UINTN BufferSize,\r
415 IN CONST CHAR8 *FormatString,\r
416 IN BASE_LIST Marker\r
417 );\r
418\r
419/**\r
420 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r
421 ASCII format string and variable argument list.\r
422 \r
423 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
424 and BufferSize.\r
425 The Unicode string is produced by parsing the format string specified by FormatString.\r
426 Arguments are pulled from the variable argument list based on the contents of the \r
427 format string.\r
428 The number of Unicode characters in the produced output buffer is returned, not including\r
429 the Null-terminator.\r
430 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
431\r
432 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
433 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
434 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
435 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
436 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then\r
437 ASSERT().\r
438 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
439 contains more than PcdMaximumUnicodeStringLength Unicode characters, the\r
440 Null-terminator, then ASSERT().\r
441\r
442 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
443 Unicode string.\r
444 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
445 @param FormatString A null-terminated ASCII format string.\r
446 @param ... Variable argument list whose contents are accessed based on the \r
447 format string specified by FormatString.\r
448 \r
449 @return The number of Unicode characters in the produced output buffer, not including the\r
450 Null-terminator.\r
451\r
452**/\r
453UINTN\r
454EFIAPI\r
455UnicodeSPrintAsciiFormat (\r
456 OUT CHAR16 *StartOfBuffer,\r
457 IN UINTN BufferSize,\r
458 IN CONST CHAR8 *FormatString,\r
459 ...\r
460 );\r
461\r
462/**\r
463 Converts a decimal value to a Null-terminated Unicode string.\r
464 \r
465 Converts the decimal number specified by Value to a Null-terminated Unicode \r
466 string specified by Buffer containing at most Width characters. No padding of spaces \r
467 is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
468 The number of Unicode characters in Buffer is returned, not including the Null-terminator.\r
469 If the conversion contains more than Width characters, then only the first\r
470 Width characters are returned, and the total number of characters \r
471 required to perform the conversion is returned.\r
472 Additional conversion parameters are specified in Flags. \r
473 \r
474 The Flags bit LEFT_JUSTIFY is always ignored.\r
475 All conversions are left justified in Buffer.\r
476 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
477 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
478 are inserted every 3rd digit starting from the right.\r
479 If RADIX_HEX is set in Flags, then the output buffer will be \r
480 formatted in hexadecimal format.\r
481 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.\r
482 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
483 then Buffer is padded with '0' characters so the combination of the optional '-' \r
484 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
485 add up to Width characters.\r
486 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r
487 If Buffer is NULL, then ASSERT().\r
488 If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
489 If unsupported bits are set in Flags, then ASSERT().\r
490 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r
491 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
492\r
493 @param Buffer The pointer to the output buffer for the produced Null-terminated\r
494 Unicode string.\r
495 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r
496 @param Value The 64-bit signed value to convert to a string.\r
497 @param Width The maximum number of Unicode characters to place in Buffer, not including\r
498 the Null-terminator.\r
499 \r
500 @return The number of Unicode characters in Buffer, not including the Null-terminator.\r
501\r
502**/\r
503UINTN\r
504EFIAPI\r
505UnicodeValueToString (\r
506 IN OUT CHAR16 *Buffer,\r
507 IN UINTN Flags,\r
508 IN INT64 Value,\r
509 IN UINTN Width\r
510 );\r
511\r
512/**\r
513 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
514 ASCII format string and a VA_LIST argument list.\r
515 \r
516 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
517 and BufferSize.\r
518 The ASCII string is produced by parsing the format string specified by FormatString.\r
519 Arguments are pulled from the variable argument list specified by Marker based on \r
520 the contents of the format string.\r
521 The number of ASCII characters in the produced output buffer is returned, not including\r
522 the Null-terminator.\r
523 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
524\r
525 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
526 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
527 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
528 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then\r
529 ASSERT().\r
530 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
531 contains more than PcdMaximumAsciiStringLength ASCII characters, not including the\r
532 Null-terminator, then ASSERT().\r
533\r
534 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
535 ASCII string.\r
536 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
537 @param FormatString A null-terminated ASCII format string.\r
538 @param Marker VA_LIST marker for the variable argument list.\r
539 \r
540 @return The number of ASCII characters in the produced output buffer, not including the\r
541 Null-terminator.\r
542\r
543**/\r
544UINTN\r
545EFIAPI\r
546AsciiVSPrint (\r
547 OUT CHAR8 *StartOfBuffer,\r
548 IN UINTN BufferSize,\r
549 IN CONST CHAR8 *FormatString,\r
550 IN VA_LIST Marker\r
551 );\r
552\r
553/**\r
554 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
555 ASCII format string and a BASE_LIST argument list.\r
556 \r
557 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
558 and BufferSize.\r
559 The ASCII string is produced by parsing the format string specified by FormatString.\r
560 Arguments are pulled from the variable argument list specified by Marker based on \r
561 the contents of the format string.\r
562 The number of ASCII characters in the produced output buffer is returned, not including\r
563 the Null-terminator.\r
564 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
565\r
566 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
567 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
568 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
569 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then\r
570 ASSERT().\r
571 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
572 contains more than PcdMaximumAsciiStringLength ASCII characters, not including the\r
573 Null-terminator, then ASSERT().\r
574\r
575 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
576 ASCII string.\r
577 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
578 @param FormatString A null-terminated ASCII format string.\r
579 @param Marker BASE_LIST marker for the variable argument list.\r
580 \r
581 @return The number of ASCII characters in the produced output buffer, not including the\r
582 Null-terminator.\r
583\r
584**/\r
585UINTN\r
586EFIAPI\r
587AsciiBSPrint (\r
588 OUT CHAR8 *StartOfBuffer,\r
589 IN UINTN BufferSize,\r
590 IN CONST CHAR8 *FormatString,\r
591 IN BASE_LIST Marker\r
592 );\r
593\r
594/**\r
595 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
596 ASCII format string and variable argument list.\r
597 \r
598 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
599 and BufferSize.\r
600 The ASCII string is produced by parsing the format string specified by FormatString.\r
601 Arguments are pulled from the variable argument list based on the contents of the \r
602 format string.\r
603 The number of ASCII characters in the produced output buffer is returned, not including\r
604 the Null-terminator.\r
605 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
606\r
607 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
608 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
609 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
610 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then\r
611 ASSERT().\r
612 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
613 contains more than PcdMaximumAsciiStringLength ASCII characters, not including the\r
614 Null-terminator, then ASSERT().\r
615\r
616 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
617 ASCII string.\r
618 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
619 @param FormatString A null-terminated ASCII format string.\r
620 @param ... The variable argument list whose contents are accessed based on the \r
621 format string specified by FormatString.\r
622 \r
623 @return The number of ASCII characters in the produced output buffer, not including the\r
624 Null-terminator.\r
625\r
626**/\r
627UINTN\r
628EFIAPI\r
629AsciiSPrint (\r
630 OUT CHAR8 *StartOfBuffer,\r
631 IN UINTN BufferSize,\r
632 IN CONST CHAR8 *FormatString,\r
633 ...\r
634 );\r
635\r
636/**\r
637 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
638 Unicode format string and a VA_LIST argument list.\r
639 \r
640 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
641 and BufferSize.\r
642 The ASCII string is produced by parsing the format string specified by FormatString.\r
643 Arguments are pulled from the variable argument list specified by Marker based on \r
644 the contents of the format string.\r
645 The number of ASCII characters in the produced output buffer is returned, not including\r
646 the Null-terminator.\r
647 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
648\r
649 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
650 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
651 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
652 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
653 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then\r
654 ASSERT().\r
655 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
656 contains more than PcdMaximumAsciiStringLength ASCII characters, not including the\r
657 Null-terminator, then ASSERT().\r
658\r
659 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
660 ASCII string.\r
661 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
662 @param FormatString A null-terminated Unicode format string.\r
663 @param Marker VA_LIST marker for the variable argument list.\r
664 \r
665 @return The number of ASCII characters in the produced output buffer, not including the\r
666 Null-terminator.\r
667\r
668**/\r
669UINTN\r
670EFIAPI\r
671AsciiVSPrintUnicodeFormat (\r
672 OUT CHAR8 *StartOfBuffer,\r
673 IN UINTN BufferSize,\r
674 IN CONST CHAR16 *FormatString,\r
675 IN VA_LIST Marker\r
676 );\r
677\r
678/**\r
679 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
680 Unicode format string and a BASE_LIST argument list.\r
681 \r
682 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
683 and BufferSize.\r
684 The ASCII string is produced by parsing the format string specified by FormatString.\r
685 Arguments are pulled from the variable argument list specified by Marker based on \r
686 the contents of the format string.\r
687 The number of ASCII characters in the produced output buffer is returned, not including\r
688 the Null-terminator.\r
689 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
690\r
691 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
692 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
693 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
694 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
695 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then\r
696 ASSERT().\r
697 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
698 contains more than PcdMaximumAsciiStringLength ASCII characters, not including the\r
699 Null-terminator, then ASSERT().\r
700\r
701 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
702 ASCII string.\r
703 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
704 @param FormatString A null-terminated Unicode format string.\r
705 @param Marker BASE_LIST marker for the variable argument list.\r
706 \r
707 @return The number of ASCII characters in the produced output buffer, not including the\r
708 Null-terminator.\r
709\r
710**/\r
711UINTN\r
712EFIAPI\r
713AsciiBSPrintUnicodeFormat (\r
714 OUT CHAR8 *StartOfBuffer,\r
715 IN UINTN BufferSize,\r
716 IN CONST CHAR16 *FormatString,\r
717 IN BASE_LIST Marker\r
718 );\r
719\r
720/**\r
721 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
722 Unicode format string and variable argument list.\r
723 \r
724 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
725 and BufferSize.\r
726 The ASCII string is produced by parsing the format string specified by FormatString.\r
727 Arguments are pulled from the variable argument list based on the contents of the \r
728 format string.\r
729 The number of ASCII characters in the produced output buffer is returned, not including\r
730 the Null-terminator.\r
731 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
732\r
733 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
734 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
735 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
736 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
737 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then\r
738 ASSERT().\r
739 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
740 contains more than PcdMaximumAsciiStringLength ASCII characters, not including the\r
741 Null-terminator, then ASSERT().\r
742\r
743 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
744 ASCII string.\r
745 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
746 @param FormatString A null-terminated Unicode format string.\r
747 @param ... Variable argument list whose contents are accessed based on the \r
748 format string specified by FormatString.\r
749 \r
750 @return The number of ASCII characters in the produced output buffer, not including the\r
751 Null-terminator.\r
752\r
753**/\r
754UINTN\r
755EFIAPI\r
756AsciiSPrintUnicodeFormat (\r
757 OUT CHAR8 *StartOfBuffer,\r
758 IN UINTN BufferSize,\r
759 IN CONST CHAR16 *FormatString,\r
760 ...\r
761 );\r
762\r
763/**\r
764 Converts a decimal value to a Null-terminated ASCII string.\r
765 \r
766 Converts the decimal number specified by Value to a Null-terminated ASCII string \r
767 specified by Buffer containing at most Width characters. No padding of spaces \r
768 is ever performed.\r
769 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
770 The number of ASCII characters in Buffer is returned, not including the Null-terminator.\r
771 If the conversion contains more than Width characters, then only the first Width\r
772 characters are returned, and the total number of characters required to perform\r
773 the conversion is returned.\r
774 Additional conversion parameters are specified in Flags. \r
775 The Flags bit LEFT_JUSTIFY is always ignored.\r
776 All conversions are left justified in Buffer.\r
777 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
778 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
779 are inserted every 3rd digit starting from the right.\r
780 If RADIX_HEX is set in Flags, then the output buffer will be \r
781 formatted in hexadecimal format.\r
782 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.\r
783 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
784 then Buffer is padded with '0' characters so the combination of the optional '-' \r
785 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
786 add up to Width characters.\r
787 \r
788 If Buffer is NULL, then ASSERT().\r
789 If unsupported bits are set in Flags, then ASSERT().\r
790 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r
791 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
792\r
793 @param Buffer A pointer to the output buffer for the produced Null-terminated\r
794 ASCII string.\r
795 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r
796 @param Value The 64-bit signed value to convert to a string.\r
797 @param Width The maximum number of ASCII characters to place in Buffer, not including\r
798 the Null-terminator.\r
799 \r
800 @return The number of ASCII characters in Buffer, not including the Null-terminator.\r
801\r
802**/\r
803UINTN\r
804EFIAPI\r
805AsciiValueToString (\r
806 OUT CHAR8 *Buffer,\r
807 IN UINTN Flags,\r
808 IN INT64 Value,\r
809 IN UINTN Width\r
810 );\r
811\r
812/**\r
813 Returns the number of characters that would be produced by if the formatted \r
814 output were produced not including the Null-terminator.\r
815\r
816 If Format is NULL, then ASSERT().\r
817 If Format is not aligned on a 16-bit boundary, then ASSERT().\r
818\r
819 @param[in] FormatString A Null-terminated Unicode format string.\r
820 @param[in] Marker VA_LIST marker for the variable argument list.\r
821\r
822 @return The number of characters that would be produced, not including the \r
823 Null-terminator.\r
824**/\r
825UINTN\r
826EFIAPI\r
827SPrintLength (\r
828 IN CONST CHAR16 *FormatString,\r
829 IN VA_LIST Marker\r
830 );\r
831\r
832/**\r
833 Returns the number of characters that would be produced by if the formatted \r
834 output were produced not including the Null-terminator.\r
835\r
836 If Format is NULL, then ASSERT().\r
837\r
838 @param[in] FormatString A Null-terminated ASCII format string.\r
839 @param[in] Marker VA_LIST marker for the variable argument list.\r
840\r
841 @return The number of characters that would be produced, not including the \r
842 Null-terminator.\r
843**/\r
844UINTN\r
845EFIAPI\r
846SPrintLengthAsciiFormat (\r
847 IN CONST CHAR8 *FormatString,\r
848 IN VA_LIST Marker\r
849 );\r
850\r
851#endif\r