]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/EdkDxePrintLib/PrintLib.c
Update doxygen comment for VarArg list parameter. "..."'s description is added.
[mirror_edk2.git] / MdeModulePkg / Library / EdkDxePrintLib / PrintLib.c
CommitLineData
504214c4 1/** @file\r
ce95aa7a 2 Instance of Print Library based on EFI_PRINT2_PROTOCOL.\r
a0afd019 3\r
504214c4
LG
4 Implement the print library instance by wrap the interface \r
5 provided in the Print protocol. This protocol is defined as the internal\r
6 protocol related to this implementation, not in the public spec. So, this \r
7 library instance is only for this code base.\r
8\r
9Copyright (c) 2006 - 2008, Intel Corporation\r
a0afd019 10All rights reserved. This program and the accompanying materials\r
11are licensed and made available under the terms and conditions of the BSD License\r
12which accompanies this distribution. The full text of the license may be found at\r
13http://opensource.org/licenses/bsd-license.php\r
14\r
15THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
16WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
17\r
504214c4 18**/\r
a0afd019 19\r
60c93673 20#include <Uefi.h>\r
ed7748fe 21\r
0ed0c867 22#include <Protocol/Print2.h>\r
ed7748fe 23\r
a0afd019 24#include <Library/PrintLib.h>\r
25#include <Library/UefiBootServicesTableLib.h>\r
26\r
fe1e36e5 27EFI_PRINT2_PROTOCOL *gPrintProtocol = NULL;\r
a0afd019 28\r
ce95aa7a 29/**\r
30 Internal function to locate the EFI_PRINT2_PROTOCOL.\r
31\r
32 @retval EFI_SUCCESS EFI_PRINT2_PROTOCOL is successfuly located.\r
33 @retval EFI_NOT_FOUND EFI_PRINT2_PROTOCOL cannot be found.\r
34\r
35**/\r
2ad4dad0
LG
36EFI_STATUS\r
37EFIAPI\r
38InternalLocatePrintProtocol (\r
ce95aa7a 39 VOID\r
a0afd019 40 )\r
a0afd019 41{\r
ce95aa7a 42 EFI_STATUS Status;\r
a0afd019 43\r
44 if (gPrintProtocol == NULL) {\r
45 Status = gBS->LocateProtocol (\r
0ed0c867 46 &gEfiPrint2ProtocolGuid,\r
a0afd019 47 NULL,\r
48 (VOID **)&gPrintProtocol\r
49 );\r
50 if (EFI_ERROR (Status)) {\r
51 gPrintProtocol = NULL;\r
2ad4dad0 52 return Status;\r
a0afd019 53 }\r
54 }\r
2ad4dad0
LG
55 \r
56 return EFI_SUCCESS;\r
57}\r
58\r
59/**\r
60 Produces a Null-terminated Unicode string in an output buffer based on \r
61 a Null-terminated Unicode format string and a VA_LIST argument list\r
62 \r
63 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
64 and BufferSize. \r
65 The Unicode string is produced by parsing the format string specified by FormatString. \r
66 Arguments are pulled from the variable argument list specified by Marker based on the \r
67 contents of the format string. \r
68 The number of Unicode characters in the produced output buffer is returned not including\r
69 the Null-terminator.\r
70 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
71\r
72 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
73 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
74 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
75 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
76 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r
77 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
78 ASSERT().\r
79 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
80 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
81 Null-terminator, then ASSERT().\r
82\r
83 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
84 Unicode string.\r
85 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
86 @param FormatString Null-terminated Unicode format string.\r
87 @param Marker VA_LIST marker for the variable argument list.\r
88 \r
89 @return The number of Unicode characters in the produced output buffer not including the\r
90 Null-terminator.\r
91\r
92**/\r
93UINTN\r
94EFIAPI\r
95UnicodeVSPrint (\r
96 OUT CHAR16 *StartOfBuffer,\r
97 IN UINTN BufferSize,\r
98 IN CONST CHAR16 *FormatString,\r
99 IN VA_LIST Marker\r
100 )\r
101{\r
102 if (InternalLocatePrintProtocol() != EFI_SUCCESS) {\r
103 return 0;\r
104 }\r
105\r
a0afd019 106 return gPrintProtocol->VSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r
107}\r
108\r
2ad4dad0
LG
109/**\r
110 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r
111 Unicode format string and variable argument list.\r
112 \r
113 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
114 and BufferSize.\r
115 The Unicode string is produced by parsing the format string specified by FormatString.\r
116 Arguments are pulled from the variable argument list based on the contents of the format string.\r
117 The number of Unicode characters in the produced output buffer is returned not including\r
118 the Null-terminator.\r
119 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
120\r
121 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
122 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
123 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
124 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
125 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r
126 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
127 ASSERT().\r
128 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
129 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
130 Null-terminator, then ASSERT().\r
131\r
132 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
133 Unicode string.\r
134 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
135 @param FormatString Null-terminated Unicode format string.\r
ce95aa7a 136 @param ... Variable argument list based on the contents of the format string.\r
137\r
2ad4dad0
LG
138 @return The number of Unicode characters in the produced output buffer not including the\r
139 Null-terminator.\r
140\r
141**/\r
a0afd019 142UINTN\r
2ad4dad0 143EFIAPI\r
a0afd019 144UnicodeSPrint (\r
145 OUT CHAR16 *StartOfBuffer,\r
146 IN UINTN BufferSize,\r
2ad4dad0 147 IN CONST CHAR16 *FormatString,\r
a0afd019 148 ...\r
149 )\r
a0afd019 150{\r
2ad4dad0 151 VA_LIST Marker;\r
a0afd019 152\r
153 VA_START (Marker, FormatString);\r
2ad4dad0 154 return UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r
a0afd019 155}\r
156\r
2ad4dad0
LG
157/**\r
158 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r
159 ASCII format string and a VA_LIST argument list\r
160 \r
161 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
162 and BufferSize.\r
163 The Unicode string is produced by parsing the format string specified by FormatString.\r
164 Arguments are pulled from the variable argument list specified by Marker based on the \r
165 contents of the format string.\r
166 The number of Unicode characters in the produced output buffer is returned not including\r
167 the Null-terminator.\r
168 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
169\r
170 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
171 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
172 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
173 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
174 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
175 ASSERT().\r
176 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
177 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
178 Null-terminator, then ASSERT().\r
179\r
180 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
181 Unicode string.\r
182 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
183 @param FormatString Null-terminated Unicode format string.\r
184 @param Marker VA_LIST marker for the variable argument list.\r
185 \r
186 @return The number of Unicode characters in the produced output buffer not including the\r
187 Null-terminator.\r
188\r
189**/\r
a0afd019 190UINTN\r
2ad4dad0
LG
191EFIAPI\r
192UnicodeVSPrintAsciiFormat (\r
193 OUT CHAR16 *StartOfBuffer,\r
194 IN UINTN BufferSize,\r
195 IN CONST CHAR8 *FormatString,\r
196 IN VA_LIST Marker\r
a0afd019 197 )\r
2ad4dad0
LG
198{\r
199 if (InternalLocatePrintProtocol() != EFI_SUCCESS) {\r
200 return 0;\r
201 }\r
a0afd019 202\r
2ad4dad0
LG
203 return gPrintProtocol->UniVSPrintAscii (StartOfBuffer, BufferSize, FormatString, Marker);\r
204}\r
a0afd019 205\r
2ad4dad0
LG
206/**\r
207 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r
208 ASCII format string and variable 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 based on the contents of the \r
214 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 PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
223 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
224 ASSERT().\r
225 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
226 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
227 Null-terminator, then ASSERT().\r
228\r
229 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
230 Unicode string.\r
231 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
232 @param FormatString Null-terminated Unicode format string.\r
ce95aa7a 233 @param ... Variable argument list based on the contents of the format string.\r
2ad4dad0
LG
234 \r
235 @return The number of Unicode characters in the produced output buffer not including the\r
236 Null-terminator.\r
237\r
238**/\r
239UINTN\r
240EFIAPI\r
241UnicodeSPrintAsciiFormat (\r
242 OUT CHAR16 *StartOfBuffer,\r
243 IN UINTN BufferSize,\r
244 IN CONST CHAR8 *FormatString,\r
245 ...\r
246 )\r
247{\r
248 VA_LIST Marker;\r
a0afd019 249\r
2ad4dad0
LG
250 VA_START (Marker, FormatString);\r
251 return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r
252}\r
a0afd019 253\r
2ad4dad0
LG
254/**\r
255 Converts a decimal value to a Null-terminated Unicode string.\r
256 \r
257 Converts the decimal number specified by Value to a Null-terminated Unicode \r
258 string specified by Buffer containing at most Width characters. No padding of spaces \r
259 is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
260 The number of Unicode characters in Buffer is returned not including the Null-terminator.\r
261 If the conversion contains more than Width characters, then only the first\r
262 Width characters are returned, and the total number of characters \r
263 required to perform the conversion is returned.\r
264 Additional conversion parameters are specified in Flags. \r
265 \r
266 The Flags bit LEFT_JUSTIFY is always ignored.\r
267 All conversions are left justified in Buffer.\r
268 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
269 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
270 are inserted every 3rd digit starting from the right.\r
271 If HEX_RADIX is set in Flags, then the output buffer will be \r
272 formatted in hexadecimal format.\r
273 If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.\r
274 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
275 then Buffer is padded with '0' characters so the combination of the optional '-' \r
276 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
277 add up to Width characters.\r
278 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r
279 If Buffer is NULL, then ASSERT().\r
280 If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
281 If unsupported bits are set in Flags, then ASSERT().\r
282 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r
283 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
284\r
285 @param Buffer Pointer to the output buffer for the produced Null-terminated\r
286 Unicode string.\r
287 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r
288 @param Value The 64-bit signed value to convert to a string.\r
289 @param Width The maximum number of Unicode characters to place in Buffer, not including\r
290 the Null-terminator.\r
291 \r
292 @return The number of Unicode characters in Buffer not including the Null-terminator.\r
293\r
294**/\r
295UINTN\r
296EFIAPI\r
297UnicodeValueToString (\r
298 IN OUT CHAR16 *Buffer,\r
299 IN UINTN Flags,\r
300 IN INT64 Value,\r
301 IN UINTN Width\r
302 )\r
303{\r
304 if (InternalLocatePrintProtocol() != EFI_SUCCESS) {\r
305 return 0;\r
306 }\r
a0afd019 307\r
2ad4dad0
LG
308 return gPrintProtocol->UniValueToString (Buffer, Flags, Value, Width);\r
309}\r
a0afd019 310\r
2ad4dad0
LG
311/**\r
312 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
313 ASCII format string and a VA_LIST argument list.\r
314 \r
315 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
316 and BufferSize.\r
317 The ASCII string is produced by parsing the format string specified by FormatString.\r
318 Arguments are pulled from the variable argument list specified by Marker based on \r
319 the contents of the format string.\r
320 The number of ASCII characters in the produced output buffer is returned not including\r
321 the Null-terminator.\r
322 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
323\r
324 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
325 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
326 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
327 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
328 ASSERT().\r
329 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
330 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
331 Null-terminator, then ASSERT().\r
332\r
333 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
334 ASCII string.\r
335 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
336 @param FormatString Null-terminated Unicode format string.\r
337 @param Marker VA_LIST marker for the variable argument list.\r
338 \r
339 @return The number of ASCII characters in the produced output buffer not including the\r
340 Null-terminator.\r
341\r
342**/\r
343UINTN\r
344EFIAPI\r
345AsciiVSPrint (\r
346 OUT CHAR8 *StartOfBuffer,\r
347 IN UINTN BufferSize,\r
348 IN CONST CHAR8 *FormatString,\r
349 IN VA_LIST Marker\r
350 )\r
a0afd019 351{\r
2ad4dad0
LG
352 if (InternalLocatePrintProtocol() != EFI_SUCCESS) {\r
353 return 0;\r
354 }\r
355\r
356 return gPrintProtocol->AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r
a0afd019 357}\r
358\r
2ad4dad0
LG
359/**\r
360 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
361 ASCII format string and variable argument list.\r
362 \r
363 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
364 and BufferSize.\r
365 The ASCII string is produced by parsing the format string specified by FormatString.\r
366 Arguments are pulled from the variable argument list based on the contents of the \r
367 format string.\r
368 The number of ASCII characters in the produced output buffer is returned not including\r
369 the Null-terminator.\r
370 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
371\r
372 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
373 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
374 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
375 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
376 ASSERT().\r
377 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
378 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
379 Null-terminator, then ASSERT().\r
380\r
381 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
382 ASCII string.\r
383 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
384 @param FormatString Null-terminated Unicode format string.\r
ce95aa7a 385 @param ... Variable argument list based on the contents of the format string.\r
386\r
2ad4dad0
LG
387 @return The number of ASCII characters in the produced output buffer not including the\r
388 Null-terminator.\r
389\r
390**/\r
a0afd019 391UINTN\r
2ad4dad0 392EFIAPI\r
a0afd019 393AsciiSPrint (\r
394 OUT CHAR8 *StartOfBuffer,\r
395 IN UINTN BufferSize,\r
2ad4dad0 396 IN CONST CHAR8 *FormatString,\r
a0afd019 397 ...\r
398 )\r
2ad4dad0
LG
399{\r
400 VA_LIST Marker;\r
401\r
402 VA_START (Marker, FormatString);\r
403 return AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r
404}\r
a0afd019 405\r
2ad4dad0
LG
406/**\r
407 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
408 ASCII format string and a VA_LIST argument list.\r
409 \r
410 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
411 and BufferSize.\r
412 The ASCII string is produced by parsing the format string specified by FormatString.\r
413 Arguments are pulled from the variable argument list specified by Marker based on \r
414 the contents of the format string.\r
415 The number of ASCII characters in the produced output buffer is returned not including\r
416 the Null-terminator.\r
417 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
418\r
419 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
420 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
421 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
422 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
423 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
424 ASSERT().\r
425 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
426 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
427 Null-terminator, then ASSERT().\r
428\r
429 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
430 ASCII string.\r
431 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
432 @param FormatString Null-terminated Unicode format string.\r
433 @param Marker VA_LIST marker for the variable argument list.\r
434 \r
435 @return The number of ASCII characters in the produced output buffer not including the\r
436 Null-terminator.\r
437\r
438**/\r
439UINTN\r
440EFIAPI\r
441AsciiVSPrintUnicodeFormat (\r
442 OUT CHAR8 *StartOfBuffer,\r
443 IN UINTN BufferSize,\r
444 IN CONST CHAR16 *FormatString,\r
445 IN VA_LIST Marker\r
446 )\r
a0afd019 447{\r
2ad4dad0
LG
448 if (InternalLocatePrintProtocol() != EFI_SUCCESS) {\r
449 return 0;\r
450 }\r
451\r
452 return gPrintProtocol->AsciiVSPrintUni (StartOfBuffer, BufferSize, FormatString, Marker);\r
453}\r
454\r
455/**\r
456 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
457 ASCII format string and variable argument list.\r
458 \r
459 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
460 and BufferSize.\r
461 The ASCII string is produced by parsing the format string specified by FormatString.\r
462 Arguments are pulled from the variable argument list based on the contents of the \r
463 format string.\r
464 The number of ASCII characters in the produced output buffer is returned not including\r
465 the Null-terminator.\r
466 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
467\r
468 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
469 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
470 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
471 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
472 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
473 ASSERT().\r
474 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
475 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
476 Null-terminator, then ASSERT().\r
477\r
478 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
479 ASCII string.\r
480 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
481 @param FormatString Null-terminated Unicode format string.\r
ce95aa7a 482 @param ... Variable argument list based on the contents of the format string.\r
483\r
2ad4dad0
LG
484 @return The number of ASCII characters in the produced output buffer not including the\r
485 Null-terminator.\r
486\r
487**/\r
488UINTN\r
489EFIAPI\r
490AsciiSPrintUnicodeFormat (\r
491 OUT CHAR8 *StartOfBuffer,\r
492 IN UINTN BufferSize,\r
493 IN CONST CHAR16 *FormatString,\r
494 ...\r
495 )\r
496{\r
497 VA_LIST Marker;\r
a0afd019 498\r
499 VA_START (Marker, FormatString);\r
2ad4dad0
LG
500 return AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r
501}\r
502\r
503\r
504/**\r
505 Converts a decimal value to a Null-terminated ASCII string.\r
506 \r
507 Converts the decimal number specified by Value to a Null-terminated ASCII string \r
508 specified by Buffer containing at most Width characters. No padding of spaces \r
509 is ever performed.\r
510 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
511 The number of ASCII characters in Buffer is returned not including the Null-terminator.\r
512 If the conversion contains more than Width characters, then only the first Width\r
513 characters are returned, and the total number of characters required to perform\r
514 the conversion is returned.\r
515 Additional conversion parameters are specified in Flags. \r
516 The Flags bit LEFT_JUSTIFY is always ignored.\r
517 All conversions are left justified in Buffer.\r
518 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
519 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
520 are inserted every 3rd digit starting from the right.\r
521 If HEX_RADIX is set in Flags, then the output buffer will be \r
522 formatted in hexadecimal format.\r
523 If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.\r
524 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
525 then Buffer is padded with '0' characters so the combination of the optional '-' \r
526 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
527 add up to Width characters.\r
528 \r
529 If Buffer is NULL, then ASSERT().\r
530 If unsupported bits are set in Flags, then ASSERT().\r
531 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r
532 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
533\r
534 @param Buffer Pointer to the output buffer for the produced Null-terminated\r
535 ASCII string.\r
536 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r
537 @param Value The 64-bit signed value to convert to a string.\r
538 @param Width The maximum number of ASCII characters to place in Buffer, not including\r
539 the Null-terminator.\r
540 \r
541 @return The number of ASCII characters in Buffer not including the Null-terminator.\r
542\r
543**/\r
544UINTN\r
545EFIAPI\r
546AsciiValueToString (\r
547 IN OUT CHAR8 *Buffer,\r
548 IN UINTN Flags,\r
549 IN INT64 Value,\r
550 IN UINTN Width\r
551 )\r
552{\r
553 if (InternalLocatePrintProtocol() != EFI_SUCCESS) {\r
554 return 0;\r
555 }\r
556\r
557 return gPrintProtocol->AsciiValueToString (Buffer, Flags, Value, Width);\r
a0afd019 558}\r