]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/PrintLib.h
Adjust the behavior of the MdePkg Print Library class to produce a consistent style...
[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
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
49 - The number being printed is a UINT64. Only valid for types X, x, and d.\r
50 If this flag is not specified, then the number being printed is a 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 prevision 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 a 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
b7ca8783 83 to be an int. This does not follow ANSI C.\r
84 - X\r
85 - The argument is a 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
b7ca8783 87 'L' is not specified, then the argument is assumed to be an int. \r
88 This does not follow ANSI C.\r
89 - d\r
90 - The argument is a decimal number. If the flag 'L' is not specified, \r
91 then the argument is assumed to be an int. \r
92 - p\r
93 - The argument is a pointer that is a (VOID *), and it is printed as a \r
94 hexadecimal number The characters used are 0..9 and A..F.\r
95 - a\r
96 - The argument is a pointer to an ASCII string. \r
97 This does not follow ANSI C.\r
98 - S, s\r
99 - The argument is a pointer to a Unicode string. \r
100 This does not follow ANSI C.\r
101 - g\r
102 - The argument is a pointer to a GUID structure. The GUID is printed \r
103 in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX. \r
104 This does not follow ANSI C.\r
105 - t\r
106 - The argument is a pointer to an EFI_TIME structure. The time and \r
c3d4e543 107 date are printed in the format "mm/dd/yyyy hh:mm" where mm is the \r
b7ca8783 108 month zero padded, dd is the day zero padded, yyyy is the year zero \r
109 padded, hh is the hour zero padded, and mm is minutes zero padded. \r
110 This does not follow ANSI C. \r
111 - r\r
112 - The argument is a RETURN_STATUS value. This value is converted to \r
113 a string following the table below. This does not follow ANSI C. \r
114 - RETURN_SUCCESS \r
115 - "Success"\r
116 - RETURN_LOAD_ERROR \r
117 - "Load Error"\r
118 - RETURN_INVALID_PARAMETER \r
119 - "Invalid Parameter"\r
120 - RETURN_UNSUPPORTED \r
121 - "Unsupported"\r
122 - RETURN_BAD_BUFFER_SIZE \r
123 - "Bad Buffer Size"\r
124 - RETURN_BUFFER_TOO_SMALL \r
125 - "Buffer Too Small"\r
126 - RETURN_NOT_READY \r
127 - "Not Ready"\r
128 - RETURN_DEVICE_ERROR \r
129 - "Device Error"\r
130 - RETURN_WRITE_PROTECTED \r
131 - "Write Protected"\r
132 - RETURN_OUT_OF_RESOURCES \r
133 - "Out of Resources"\r
134 - RETURN_VOLUME_CORRUPTED \r
135 - "Volume Corrupt"\r
136 - RETURN_VOLUME_FULL \r
137 - "Volume Full"\r
138 - RETURN_NO_MEDIA \r
139 - "No Media"\r
140 - RETURN_MEDIA_CHANGED \r
141 - "Media changed"\r
142 - RETURN_NOT_FOUND \r
143 - "Not Found"\r
144 - RETURN_ACCESS_DENIED \r
145 - "Access Denied"\r
146 - RETURN_NO_RESPONSE \r
147 - "No Response"\r
148 - RETURN_NO_MAPPING \r
149 - "No mapping"\r
150 - RETURN_TIMEOUT \r
151 - "Time out"\r
152 - RETURN_NOT_STARTED \r
153 - "Not started"\r
154 - RETURN_ALREADY_STARTED \r
155 - "Already started"\r
156 - RETURN_ABORTED \r
157 - "Aborted"\r
158 - RETURN_ICMP_ERROR \r
159 - "ICMP Error"\r
160 - RETURN_TFTP_ERROR \r
161 - "TFTP Error"\r
162 - RETURN_PROTOCOL_ERROR \r
163 - "Protocol Error"\r
164 - RETURN_WARN_UNKNOWN_GLYPH \r
165 - "Warning Unknown Glyph"\r
166 - RETURN_WARN_DELETE_FAILURE \r
167 - "Warning Delete Failure"\r
168 - RETURN_WARN_WRITE_FAILURE \r
169 - "Warning Write Failure"\r
170 - RETURN_WARN_BUFFER_TOO_SMALL \r
171 - "Warning Buffer Too Small"\r
172\r
488ee641 173**/\r
174\r
175#ifndef __PRINT_LIB_H__\r
176#define __PRINT_LIB_H__\r
177\r
178///\r
179/// Define the maximum number of characters that are required to\r
a9b896f4 180/// encode a decimal, hexadecimal, GUID, or TIME value with a NULL \r
488ee641 181/// terminator.\r
182/// \r
183/// Maximum Length Decimal String = 28\r
184/// "-9,223,372,036,854,775,808"\r
a9b896f4 185/// Maximum Length Hexadecimal String = 17\r
488ee641 186/// "FFFFFFFFFFFFFFFF"\r
187/// Maximum Length GUID = 37\r
188/// "00000000-0000-0000-0000-000000000000"\r
189/// Maximum Length TIME = 18\r
190/// "12/12/2006 12:12"\r
191///\r
192#define MAXIMUM_VALUE_CHARACTERS 38\r
193\r
194///\r
195/// Flags bitmask values use in UnicodeValueToString() and \r
196/// AsciiValueToString()\r
197///\r
198#define LEFT_JUSTIFY 0x01\r
199#define COMMA_TYPE 0x08\r
200#define PREFIX_ZERO 0x20\r
201#define RADIX_HEX 0x80\r
202\r
203/**\r
204 Produces a Null-terminated Unicode string in an output buffer based on \r
205 a Null-terminated Unicode format string and a VA_LIST argument list\r
206 \r
207 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
208 and BufferSize. \r
209 The Unicode string is produced by parsing the format string specified by FormatString. \r
210 Arguments are pulled from the variable argument list specified by Marker based on the \r
211 contents of the format string. \r
212 The number of Unicode characters in the produced output buffer is returned not including\r
213 the Null-terminator.\r
214 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
215\r
216 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
217 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
218 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
219 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
220 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r
221 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
222 ASSERT().\r
223 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
224 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
225 Null-terminator, then ASSERT().\r
226\r
227 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
228 Unicode string.\r
229 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
230 @param FormatString Null-terminated Unicode format string.\r
231 @param Marker VA_LIST marker for the variable argument list.\r
232 \r
233 @return The number of Unicode characters in the produced output buffer not including the\r
234 Null-terminator.\r
235\r
236**/\r
237UINTN\r
238EFIAPI\r
239UnicodeVSPrint (\r
240 OUT CHAR16 *StartOfBuffer,\r
241 IN UINTN BufferSize,\r
242 IN CONST CHAR16 *FormatString,\r
243 IN VA_LIST Marker\r
244 );\r
245\r
2075236e 246/**\r
247 Produces a Null-terminated Unicode string in an output buffer based on \r
248 a Null-terminated Unicode format string and a BASE_LIST argument list\r
249 \r
250 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
251 and BufferSize. \r
252 The Unicode string is produced by parsing the format string specified by FormatString. \r
253 Arguments are pulled from the variable argument list specified by Marker based on the \r
254 contents of the format string. \r
255 The number of Unicode characters in the produced output buffer is returned not including\r
256 the Null-terminator.\r
257 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
258\r
259 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
260 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
261 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
262 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
263 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r
264 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
265 ASSERT().\r
266 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
267 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
268 Null-terminator, then ASSERT().\r
269\r
270 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
271 Unicode string.\r
272 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
273 @param FormatString Null-terminated Unicode format string.\r
274 @param Marker BASE_LIST marker for the variable argument list.\r
275 \r
276 @return The number of Unicode characters in the produced output buffer not including the\r
277 Null-terminator.\r
278\r
279**/\r
280UINTN\r
281EFIAPI\r
282UnicodeBSPrint (\r
283 OUT CHAR16 *StartOfBuffer,\r
284 IN UINTN BufferSize,\r
285 IN CONST CHAR16 *FormatString,\r
286 IN BASE_LIST Marker\r
287 );\r
288\r
488ee641 289/**\r
290 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r
291 Unicode format string and variable argument list.\r
292 \r
293 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
294 and BufferSize.\r
295 The Unicode string is produced by parsing the format string specified by FormatString.\r
296 Arguments are pulled from the variable argument list based on the contents of the format string.\r
297 The number of Unicode characters in the produced output buffer is returned not including\r
298 the Null-terminator.\r
299 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
300\r
301 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
302 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
303 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
304 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
305 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r
306 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
307 ASSERT().\r
308 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
309 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
310 Null-terminator, then ASSERT().\r
311\r
312 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
313 Unicode string.\r
314 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
315 @param FormatString Null-terminated Unicode format string.\r
285010e7 316 @param ... Variable argument list whose contents are accessed based on the \r
317 format string specified by FormatString.\r
488ee641 318 \r
319 @return The number of Unicode characters in the produced output buffer not including the\r
320 Null-terminator.\r
321\r
322**/\r
323UINTN\r
324EFIAPI\r
325UnicodeSPrint (\r
326 OUT CHAR16 *StartOfBuffer,\r
327 IN UINTN BufferSize,\r
328 IN CONST CHAR16 *FormatString,\r
329 ...\r
330 );\r
331\r
332/**\r
333 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r
334 ASCII format string and a VA_LIST argument list\r
335 \r
336 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
337 and BufferSize.\r
338 The Unicode string is produced by parsing the format string specified by FormatString.\r
339 Arguments are pulled from the variable argument list specified by Marker based on the \r
340 contents of the format string.\r
341 The number of Unicode characters in the produced output buffer is returned not including\r
342 the Null-terminator.\r
343 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
344\r
345 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
346 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
347 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
348 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
349 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
350 ASSERT().\r
351 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
352 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
353 Null-terminator, then ASSERT().\r
354\r
355 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
356 Unicode string.\r
357 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
358 @param FormatString Null-terminated ASCII format string.\r
359 @param Marker VA_LIST marker for the variable argument list.\r
360 \r
361 @return The number of Unicode characters in the produced output buffer not including the\r
362 Null-terminator.\r
363\r
364**/\r
365UINTN\r
366EFIAPI\r
367UnicodeVSPrintAsciiFormat (\r
368 OUT CHAR16 *StartOfBuffer,\r
369 IN UINTN BufferSize,\r
370 IN CONST CHAR8 *FormatString,\r
371 IN VA_LIST Marker\r
372 );\r
373\r
2075236e 374/**\r
375 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r
376 ASCII format string and a BASE_LIST argument list\r
377 \r
378 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
379 and BufferSize.\r
380 The Unicode string is produced by parsing the format string specified by FormatString.\r
381 Arguments are pulled from the variable argument list specified by Marker based on the \r
382 contents of the format string.\r
383 The number of Unicode characters in the produced output buffer is returned not including\r
384 the Null-terminator.\r
385 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
386\r
387 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
388 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
389 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
390 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
391 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
392 ASSERT().\r
393 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
394 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
395 Null-terminator, then ASSERT().\r
396\r
397 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
398 Unicode string.\r
399 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
400 @param FormatString Null-terminated ASCII format string.\r
401 @param Marker BASE_LIST marker for the variable argument list.\r
402 \r
403 @return The number of Unicode characters in the produced output buffer not including the\r
404 Null-terminator.\r
405\r
406**/\r
407UINTN\r
408EFIAPI\r
409UnicodeBSPrintAsciiFormat (\r
410 OUT CHAR16 *StartOfBuffer,\r
411 IN UINTN BufferSize,\r
412 IN CONST CHAR8 *FormatString,\r
413 IN BASE_LIST Marker\r
414 );\r
415\r
488ee641 416/**\r
417 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r
418 ASCII format string and variable argument list.\r
419 \r
420 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
421 and BufferSize.\r
422 The Unicode string is produced by parsing the format string specified by FormatString.\r
423 Arguments are pulled from the variable argument list based on the contents of the \r
424 format string.\r
425 The number of Unicode characters in the produced output buffer is returned not including\r
426 the Null-terminator.\r
427 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
428\r
429 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
430 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
431 If BufferSize > 1 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 PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
436 contains more than PcdMaximumUnicodeStringLength Unicode 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 Unicode 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
285010e7 443 @param ... Variable argument list whose contents are accessed based on the \r
444 format string specified by FormatString.\r
488ee641 445 \r
446 @return The number of Unicode characters in the produced output buffer not including the\r
447 Null-terminator.\r
448\r
449**/\r
450UINTN\r
451EFIAPI\r
452UnicodeSPrintAsciiFormat (\r
453 OUT CHAR16 *StartOfBuffer,\r
454 IN UINTN BufferSize,\r
455 IN CONST CHAR8 *FormatString,\r
456 ...\r
457 );\r
458\r
459/**\r
460 Converts a decimal value to a Null-terminated Unicode string.\r
461 \r
462 Converts the decimal number specified by Value to a Null-terminated Unicode \r
463 string specified by Buffer containing at most Width characters. No padding of spaces \r
464 is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
465 The number of Unicode characters in Buffer is returned not including the Null-terminator.\r
466 If the conversion contains more than Width characters, then only the first\r
467 Width characters are returned, and the total number of characters \r
468 required to perform the conversion is returned.\r
469 Additional conversion parameters are specified in Flags. \r
470 \r
471 The Flags bit LEFT_JUSTIFY is always ignored.\r
472 All conversions are left justified in Buffer.\r
473 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
474 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
475 are inserted every 3rd digit starting from the right.\r
476 If HEX_RADIX is set in Flags, then the output buffer will be \r
477 formatted in hexadecimal format.\r
478 If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.\r
479 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
480 then Buffer is padded with '0' characters so the combination of the optional '-' \r
481 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
482 add up to Width characters.\r
483 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r
484 If Buffer is NULL, then ASSERT().\r
485 If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
486 If unsupported bits are set in Flags, then ASSERT().\r
487 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r
488 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
489\r
490 @param Buffer Pointer to the output buffer for the produced Null-terminated\r
491 Unicode string.\r
492 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r
493 @param Value The 64-bit signed value to convert to a string.\r
494 @param Width The maximum number of Unicode characters to place in Buffer, not including\r
495 the Null-terminator.\r
496 \r
497 @return The number of Unicode characters in Buffer not including the Null-terminator.\r
498\r
499**/\r
500UINTN\r
501EFIAPI\r
502UnicodeValueToString (\r
503 IN OUT CHAR16 *Buffer,\r
504 IN UINTN Flags,\r
505 IN INT64 Value,\r
506 IN UINTN Width\r
507 );\r
508\r
509/**\r
510 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
511 ASCII format string and a VA_LIST argument list.\r
512 \r
513 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
514 and BufferSize.\r
515 The ASCII string is produced by parsing the format string specified by FormatString.\r
516 Arguments are pulled from the variable argument list specified by Marker based on \r
517 the contents of the format string.\r
518 The number of ASCII characters in the produced output buffer is returned not including\r
519 the Null-terminator.\r
520 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
521\r
522 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
523 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
524 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
525 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
526 ASSERT().\r
527 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
528 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
529 Null-terminator, then ASSERT().\r
530\r
531 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
532 ASCII string.\r
533 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
534 @param FormatString Null-terminated ASCII format string.\r
535 @param Marker VA_LIST marker for the variable argument list.\r
536 \r
537 @return The number of ASCII characters in the produced output buffer not including the\r
538 Null-terminator.\r
539\r
540**/\r
541UINTN\r
542EFIAPI\r
543AsciiVSPrint (\r
544 OUT CHAR8 *StartOfBuffer,\r
545 IN UINTN BufferSize,\r
546 IN CONST CHAR8 *FormatString,\r
547 IN VA_LIST Marker\r
548 );\r
549\r
2075236e 550/**\r
551 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
552 ASCII format string and a BASE_LIST argument list.\r
553 \r
554 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
555 and BufferSize.\r
556 The ASCII string is produced by parsing the format string specified by FormatString.\r
557 Arguments are pulled from the variable argument list specified by Marker based on \r
558 the contents of the format string.\r
559 The number of ASCII characters in the produced output buffer is returned not including\r
560 the Null-terminator.\r
561 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
562\r
563 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
564 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
565 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
566 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
567 ASSERT().\r
568 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
569 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
570 Null-terminator, then ASSERT().\r
571\r
572 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
573 ASCII string.\r
574 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
575 @param FormatString Null-terminated ASCII format string.\r
576 @param Marker BASE_LIST marker for the variable argument list.\r
577 \r
578 @return The number of ASCII characters in the produced output buffer not including the\r
579 Null-terminator.\r
580\r
581**/\r
582UINTN\r
583EFIAPI\r
584AsciiBSPrint (\r
585 OUT CHAR8 *StartOfBuffer,\r
586 IN UINTN BufferSize,\r
587 IN CONST CHAR8 *FormatString,\r
588 IN BASE_LIST Marker\r
589 );\r
590\r
488ee641 591/**\r
592 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
593 ASCII format string and variable argument list.\r
594 \r
595 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
596 and BufferSize.\r
597 The ASCII string is produced by parsing the format string specified by FormatString.\r
598 Arguments are pulled from the variable argument list based on the contents of the \r
599 format string.\r
600 The number of ASCII characters in the produced output buffer is returned not including\r
601 the Null-terminator.\r
602 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
603\r
604 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
605 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
606 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
607 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
608 ASSERT().\r
609 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
610 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
611 Null-terminator, then ASSERT().\r
612\r
613 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
614 ASCII string.\r
615 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
616 @param FormatString Null-terminated ASCII format string.\r
285010e7 617 @param ... Variable argument list whose contents are accessed based on the \r
618 format string specified by FormatString.\r
488ee641 619 \r
620 @return The number of ASCII characters in the produced output buffer not including the\r
621 Null-terminator.\r
622\r
623**/\r
624UINTN\r
625EFIAPI\r
626AsciiSPrint (\r
627 OUT CHAR8 *StartOfBuffer,\r
628 IN UINTN BufferSize,\r
629 IN CONST CHAR8 *FormatString,\r
630 ...\r
631 );\r
632\r
633/**\r
634 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
635 Unicode format string and a VA_LIST argument list.\r
636 \r
637 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
638 and BufferSize.\r
639 The ASCII string is produced by parsing the format string specified by FormatString.\r
640 Arguments are pulled from the variable argument list specified by Marker based on \r
641 the contents of the format string.\r
642 The number of ASCII characters in the produced output buffer is returned not including\r
643 the Null-terminator.\r
644 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
645\r
646 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
647 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
648 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
649 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
650 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
651 ASSERT().\r
652 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
653 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
654 Null-terminator, then ASSERT().\r
655\r
656 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
657 ASCII string.\r
658 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
659 @param FormatString Null-terminated Unicode format string.\r
660 @param Marker VA_LIST marker for the variable argument list.\r
661 \r
662 @return The number of ASCII characters in the produced output buffer not including the\r
663 Null-terminator.\r
664\r
665**/\r
666UINTN\r
667EFIAPI\r
668AsciiVSPrintUnicodeFormat (\r
669 OUT CHAR8 *StartOfBuffer,\r
670 IN UINTN BufferSize,\r
671 IN CONST CHAR16 *FormatString,\r
672 IN VA_LIST Marker\r
673 );\r
674\r
2075236e 675/**\r
676 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
677 Unicode format string and a BASE_LIST argument list.\r
678 \r
679 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
680 and BufferSize.\r
681 The ASCII string is produced by parsing the format string specified by FormatString.\r
682 Arguments are pulled from the variable argument list specified by Marker based on \r
683 the contents of the format string.\r
684 The number of ASCII characters in the produced output buffer is returned not including\r
685 the Null-terminator.\r
686 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
687\r
688 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
689 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
690 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
691 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
692 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
693 ASSERT().\r
694 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
695 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
696 Null-terminator, then ASSERT().\r
697\r
698 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
699 ASCII string.\r
700 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
701 @param FormatString Null-terminated Unicode format string.\r
702 @param Marker BASE_LIST marker for the variable argument list.\r
703 \r
704 @return The number of ASCII characters in the produced output buffer not including the\r
705 Null-terminator.\r
706\r
707**/\r
708UINTN\r
709EFIAPI\r
710AsciiBSPrintUnicodeFormat (\r
711 OUT CHAR8 *StartOfBuffer,\r
712 IN UINTN BufferSize,\r
713 IN CONST CHAR16 *FormatString,\r
714 IN BASE_LIST Marker\r
715 );\r
716\r
488ee641 717/**\r
718 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
719 Unicode format string and variable argument list.\r
720 \r
721 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
722 and BufferSize.\r
723 The ASCII string is produced by parsing the format string specified by FormatString.\r
724 Arguments are pulled from the variable argument list based on the contents of the \r
725 format string.\r
726 The number of ASCII characters in the produced output buffer is returned not including\r
727 the Null-terminator.\r
728 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
729\r
730 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
731 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
732 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
733 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
734 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
735 ASSERT().\r
736 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
737 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
738 Null-terminator, then ASSERT().\r
739\r
740 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
741 ASCII string.\r
742 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
743 @param FormatString Null-terminated Unicode format string.\r
285010e7 744 @param ... Variable argument list whose contents are accessed based on the \r
745 format string specified by FormatString.\r
488ee641 746 \r
747 @return The number of ASCII characters in the produced output buffer not including the\r
748 Null-terminator.\r
749\r
750**/\r
751UINTN\r
752EFIAPI\r
753AsciiSPrintUnicodeFormat (\r
754 OUT CHAR8 *StartOfBuffer,\r
755 IN UINTN BufferSize,\r
756 IN CONST CHAR16 *FormatString,\r
757 ...\r
758 );\r
759\r
760/**\r
761 Converts a decimal value to a Null-terminated ASCII string.\r
762 \r
763 Converts the decimal number specified by Value to a Null-terminated ASCII string \r
764 specified by Buffer containing at most Width characters. No padding of spaces \r
765 is ever performed.\r
766 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
767 The number of ASCII characters in Buffer is returned not including the Null-terminator.\r
768 If the conversion contains more than Width characters, then only the first Width\r
769 characters are returned, and the total number of characters required to perform\r
770 the conversion is returned.\r
771 Additional conversion parameters are specified in Flags. \r
772 The Flags bit LEFT_JUSTIFY is always ignored.\r
773 All conversions are left justified in Buffer.\r
774 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
775 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
776 are inserted every 3rd digit starting from the right.\r
777 If HEX_RADIX is set in Flags, then the output buffer will be \r
778 formatted in hexadecimal format.\r
779 If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.\r
780 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
781 then Buffer is padded with '0' characters so the combination of the optional '-' \r
782 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
783 add up to Width characters.\r
784 \r
785 If Buffer is NULL, then ASSERT().\r
786 If unsupported bits are set in Flags, then ASSERT().\r
787 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r
788 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
789\r
790 @param Buffer Pointer to the output buffer for the produced Null-terminated\r
791 ASCII string.\r
792 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r
793 @param Value The 64-bit signed value to convert to a string.\r
794 @param Width The maximum number of ASCII characters to place in Buffer, not including\r
795 the Null-terminator.\r
796 \r
797 @return The number of ASCII characters in Buffer not including the Null-terminator.\r
798\r
799**/\r
800UINTN\r
801EFIAPI\r
802AsciiValueToString (\r
58125b7a 803 OUT CHAR8 *Buffer,\r
804 IN UINTN Flags,\r
805 IN INT64 Value,\r
806 IN UINTN Width\r
488ee641 807 );\r
808\r
809#endif\r