]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/PrintLib.h
Grammatical and disclaimer changes (does not follow internal C coding stds.)
[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
af2dc6a7 5Copyright (c) 2006 - 2010, 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
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
ad5ecf12 66 - The precision of the field is specified by a UINTN argument in the \r
b7ca8783 67 argument list.\r
68 - number\r
69 - The number specified as a decimal value represents the precision of \r
70 the field.\r
71 - NOTE: If [.precision] is not specified, then a precision of 0 is assumed.\r
72\r
73 type:\r
74\r
75 - %\r
76 - Print a %%.\r
77 - c\r
78 - The argument is a Unicode character. ASCII characters can be printed \r
79 using this type too by making sure bits 8..15 of the argument are set to 0.\r
80 - x\r
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
af2dc6a7 180/// encode with a NULL terminator a decimal, hexadecimal, GUID, \r
181/// or TIME value.\r
488ee641 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
af2dc6a7 205 a Null-terminated Unicode format string and a VA_LIST argument list.\r
488ee641 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
af2dc6a7 212 The number of Unicode characters in the produced output buffer is returned, not including\r
488ee641 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
af2dc6a7 221 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then\r
488ee641 222 ASSERT().\r
223 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
af2dc6a7 224 contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the\r
488ee641 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
af2dc6a7 233 @return The number of Unicode characters in the produced output buffer, not including the\r
488ee641 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
af2dc6a7 248 a Null-terminated Unicode format string and a BASE_LIST argument list.\r
2075236e 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
af2dc6a7 255 The number of Unicode characters in the produced output buffer is returned, not including\r
2075236e 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
af2dc6a7 264 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then\r
2075236e 265 ASSERT().\r
266 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
af2dc6a7 267 contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the\r
2075236e 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
af2dc6a7 276 @return The number of Unicode characters in the produced output buffer, not including the\r
2075236e 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
af2dc6a7 297 The number of Unicode characters in the produced output buffer is returned, not including\r
488ee641 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
af2dc6a7 315 @param FormatString A null-terminated Unicode format string.\r
316 @param ... The variable argument list whose contents are accessed based on the \r
285010e7 317 format string specified by FormatString.\r
488ee641 318 \r
af2dc6a7 319 @return The number of Unicode characters in the produced output buffer, not including the\r
488ee641 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
af2dc6a7 341 The number of Unicode characters in the produced output buffer is returned, not including\r
488ee641 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
af2dc6a7 349 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then\r
488ee641 350 ASSERT().\r
351 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
af2dc6a7 352 contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the\r
488ee641 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
af2dc6a7 358 @param FormatString A null-terminated ASCII format string.\r
488ee641 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
af2dc6a7 383 The number of Unicode characters in the produced output buffer is returned, not including\r
2075236e 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
af2dc6a7 391 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then\r
2075236e 392 ASSERT().\r
393 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
af2dc6a7 394 contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the\r
2075236e 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
af2dc6a7 400 @param FormatString A null-terminated ASCII format string.\r
401 @param Marker A BASE_LIST marker for the variable argument list.\r
2075236e 402 \r
af2dc6a7 403 @return The number of Unicode characters in the produced output buffer, not including the\r
2075236e 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
af2dc6a7 425 The number of Unicode characters in the produced output buffer is returned, not including\r
488ee641 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
af2dc6a7 433 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then\r
488ee641 434 ASSERT().\r
435 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
af2dc6a7 436 contains more than PcdMaximumUnicodeStringLength Unicode characters, the\r
488ee641 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
af2dc6a7 442 @param FormatString A 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
af2dc6a7 446 @return The number of Unicode characters in the produced output buffer, not including the\r
488ee641 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
af2dc6a7 465 The number of Unicode characters in Buffer is returned, not including the Null-terminator.\r
488ee641 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
df8d0595 476 If RADIX_HEX is set in Flags, then the output buffer will be \r
488ee641 477 formatted in hexadecimal format.\r
df8d0595 478 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.\r
488ee641 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
df8d0595 483 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r
488ee641 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
df8d0595 487 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r
488ee641 488 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
489\r
af2dc6a7 490 @param Buffer The pointer to the output buffer for the produced Null-terminated\r
488ee641 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
af2dc6a7 497 @return The number of Unicode characters in Buffer, not including the Null-terminator.\r
488ee641 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
af2dc6a7 518 The number of ASCII characters in the produced output buffer is returned, not including\r
488ee641 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
af2dc6a7 525 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then\r
488ee641 526 ASSERT().\r
527 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
af2dc6a7 528 contains more than PcdMaximumAsciiStringLength ASCII characters, not including the\r
488ee641 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
af2dc6a7 534 @param FormatString A null-terminated ASCII format string.\r
488ee641 535 @param Marker VA_LIST marker for the variable argument list.\r
536 \r
af2dc6a7 537 @return The number of ASCII characters in the produced output buffer, not including the\r
488ee641 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
af2dc6a7 559 The number of ASCII characters in the produced output buffer is returned, not including\r
2075236e 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
af2dc6a7 566 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then\r
2075236e 567 ASSERT().\r
568 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
af2dc6a7 569 contains more than PcdMaximumAsciiStringLength ASCII characters, not including the\r
2075236e 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
af2dc6a7 575 @param FormatString A null-terminated ASCII format string.\r
2075236e 576 @param Marker BASE_LIST marker for the variable argument list.\r
577 \r
af2dc6a7 578 @return The number of ASCII characters in the produced output buffer, not including the\r
2075236e 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
af2dc6a7 600 The number of ASCII characters in the produced output buffer is returned, not including\r
488ee641 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
af2dc6a7 607 PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then\r
488ee641 608 ASSERT().\r
609 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
af2dc6a7 610 contains more than PcdMaximumAsciiStringLength ASCII characters, not including the\r
488ee641 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
af2dc6a7 616 @param FormatString A null-terminated ASCII format string.\r
617 @param ... The variable argument list whose contents are accessed based on the \r
285010e7 618 format string specified by FormatString.\r
488ee641 619 \r
af2dc6a7 620 @return The number of ASCII characters in the produced output buffer, not including the\r
488ee641 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
af2dc6a7 642 The number of ASCII characters in the produced output buffer is returned, not including\r
488ee641 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
af2dc6a7 650 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then\r
488ee641 651 ASSERT().\r
652 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
af2dc6a7 653 contains more than PcdMaximumAsciiStringLength ASCII characters, not including the\r
488ee641 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
af2dc6a7 659 @param FormatString A null-terminated Unicode format string.\r
488ee641 660 @param Marker VA_LIST marker for the variable argument list.\r
661 \r
af2dc6a7 662 @return The number of ASCII characters in the produced output buffer, not including the\r
488ee641 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
af2dc6a7 684 The number of ASCII characters in the produced output buffer is returned, not including\r
2075236e 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
af2dc6a7 692 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then\r
2075236e 693 ASSERT().\r
694 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
af2dc6a7 695 contains more than PcdMaximumAsciiStringLength ASCII characters, not including the\r
2075236e 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
af2dc6a7 701 @param FormatString A null-terminated Unicode format string.\r
2075236e 702 @param Marker BASE_LIST marker for the variable argument list.\r
703 \r
af2dc6a7 704 @return The number of ASCII characters in the produced output buffer, not including the\r
2075236e 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
af2dc6a7 726 The number of ASCII characters in the produced output buffer is returned, not including\r
488ee641 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
af2dc6a7 734 PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then\r
488ee641 735 ASSERT().\r
736 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
af2dc6a7 737 contains more than PcdMaximumAsciiStringLength ASCII characters, not including the\r
488ee641 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
af2dc6a7 743 @param FormatString A 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
af2dc6a7 747 @return The number of ASCII characters in the produced output buffer, not including the\r
488ee641 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
af2dc6a7 767 The number of ASCII characters in Buffer is returned, not including the Null-terminator.\r
488ee641 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
df8d0595 777 If RADIX_HEX is set in Flags, then the output buffer will be \r
488ee641 778 formatted in hexadecimal format.\r
df8d0595 779 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.\r
488ee641 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
df8d0595 787 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r
488ee641 788 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
789\r
af2dc6a7 790 @param Buffer A pointer to the output buffer for the produced Null-terminated\r
488ee641 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
af2dc6a7 797 @return The number of ASCII characters in Buffer, not including the Null-terminator.\r
488ee641 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