]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BasePrintLib/PrintLib.c
2 Base Print Library instance implementation.
4 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
5 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include "PrintLibInternal.h"
19 // Declare a VA_LIST global variable that is used in calls to BasePrintLibSPrintMarker()
20 // when the BASE_LIST parameter is valid and the VA_LIST parameter is ignored.
21 // A NULL VA_LIST can not be passed into BasePrintLibSPrintMarker() because some
22 // compilers define VA_LIST to be a structure.
26 #define ASSERT_UNICODE_BUFFER(Buffer) ASSERT ((((UINTN) (Buffer)) & 0x01) == 0)
29 Produces a Null-terminated Unicode string in an output buffer based on
30 a Null-terminated Unicode format string and a VA_LIST argument list
32 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
34 The Unicode string is produced by parsing the format string specified by FormatString.
35 Arguments are pulled from the variable argument list specified by Marker based on the
36 contents of the format string.
37 The number of Unicode characters in the produced output buffer is returned not including
39 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
41 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
42 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
43 If BufferSize > 1 and FormatString is NULL, then ASSERT().
44 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
45 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
46 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
48 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
49 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
50 Null-terminator, then ASSERT().
52 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
54 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
55 @param FormatString A Null-terminated Unicode format string.
56 @param Marker VA_LIST marker for the variable argument list.
58 @return The number of Unicode characters in the produced output buffer not including the
65 OUT CHAR16
*StartOfBuffer
,
67 IN CONST CHAR16
*FormatString
,
71 ASSERT_UNICODE_BUFFER (StartOfBuffer
);
72 ASSERT_UNICODE_BUFFER (FormatString
);
73 return BasePrintLibSPrintMarker ((CHAR8
*)StartOfBuffer
, BufferSize
>> 1, FORMAT_UNICODE
| OUTPUT_UNICODE
, (CHAR8
*)FormatString
, Marker
, NULL
);
77 Produces a Null-terminated Unicode string in an output buffer based on
78 a Null-terminated Unicode format string and a BASE_LIST argument list
80 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
82 The Unicode string is produced by parsing the format string specified by FormatString.
83 Arguments are pulled from the variable argument list specified by Marker based on the
84 contents of the format string.
85 The number of Unicode characters in the produced output buffer is returned not including
87 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
89 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
90 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
91 If BufferSize > 1 and FormatString is NULL, then ASSERT().
92 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
93 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
94 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
96 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
97 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
98 Null-terminator, then ASSERT().
100 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
102 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
103 @param FormatString A Null-terminated Unicode format string.
104 @param Marker BASE_LIST marker for the variable argument list.
106 @return The number of Unicode characters in the produced output buffer not including the
113 OUT CHAR16
*StartOfBuffer
,
115 IN CONST CHAR16
*FormatString
,
119 ASSERT_UNICODE_BUFFER (StartOfBuffer
);
120 ASSERT_UNICODE_BUFFER (FormatString
);
121 return BasePrintLibSPrintMarker ((CHAR8
*)StartOfBuffer
, BufferSize
>> 1, FORMAT_UNICODE
| OUTPUT_UNICODE
, (CHAR8
*)FormatString
, gNullVaList
, Marker
);
125 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
126 Unicode format string and variable argument list.
128 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
130 The Unicode string is produced by parsing the format string specified by FormatString.
131 Arguments are pulled from the variable argument list based on the contents of the format string.
132 The number of Unicode characters in the produced output buffer is returned not including
134 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
136 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
137 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
138 If BufferSize > 1 and FormatString is NULL, then ASSERT().
139 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
140 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
141 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
143 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
144 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
145 Null-terminator, then ASSERT().
147 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
149 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
150 @param FormatString A Null-terminated Unicode format string.
151 @param ... Variable argument list whose contents are accessed based on the
152 format string specified by FormatString.
154 @return The number of Unicode characters in the produced output buffer not including the
161 OUT CHAR16
*StartOfBuffer
,
163 IN CONST CHAR16
*FormatString
,
168 UINTN NumberOfPrinted
;
170 VA_START (Marker
, FormatString
);
171 NumberOfPrinted
= UnicodeVSPrint (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
173 return NumberOfPrinted
;
177 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
178 ASCII format string and a VA_LIST argument list
180 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
182 The Unicode string is produced by parsing the format string specified by FormatString.
183 Arguments are pulled from the variable argument list specified by Marker based on the
184 contents of the format string.
185 The number of Unicode characters in the produced output buffer is returned not including
187 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
189 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
190 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
191 If BufferSize > 1 and FormatString is NULL, then ASSERT().
192 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
193 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
195 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
196 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
197 Null-terminator, then ASSERT().
199 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
201 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
202 @param FormatString A Null-terminated ASCII format string.
203 @param Marker VA_LIST marker for the variable argument list.
205 @return The number of Unicode characters in the produced output buffer not including the
211 UnicodeVSPrintAsciiFormat (
212 OUT CHAR16
*StartOfBuffer
,
214 IN CONST CHAR8
*FormatString
,
218 ASSERT_UNICODE_BUFFER (StartOfBuffer
);
219 return BasePrintLibSPrintMarker ((CHAR8
*)StartOfBuffer
, BufferSize
>> 1, OUTPUT_UNICODE
, FormatString
, Marker
, NULL
);
223 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
224 ASCII format string and a BASE_LIST argument list
226 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
228 The Unicode string is produced by parsing the format string specified by FormatString.
229 Arguments are pulled from the variable argument list specified by Marker based on the
230 contents of the format string.
231 The number of Unicode characters in the produced output buffer is returned not including
233 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
235 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
236 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
237 If BufferSize > 1 and FormatString is NULL, then ASSERT().
238 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
239 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
241 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
242 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
243 Null-terminator, then ASSERT().
245 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
247 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
248 @param FormatString A Null-terminated ASCII format string.
249 @param Marker BASE_LIST marker for the variable argument list.
251 @return The number of Unicode characters in the produced output buffer not including the
257 UnicodeBSPrintAsciiFormat (
258 OUT CHAR16
*StartOfBuffer
,
260 IN CONST CHAR8
*FormatString
,
264 ASSERT_UNICODE_BUFFER (StartOfBuffer
);
265 return BasePrintLibSPrintMarker ((CHAR8
*)StartOfBuffer
, BufferSize
>> 1, OUTPUT_UNICODE
, FormatString
, gNullVaList
, Marker
);
269 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
270 ASCII format string and variable argument list.
272 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
274 The Unicode string is produced by parsing the format string specified by FormatString.
275 Arguments are pulled from the variable argument list based on the contents of the
277 The number of Unicode characters in the produced output buffer is returned not including
279 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
281 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
282 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
283 If BufferSize > 1 and FormatString is NULL, then ASSERT().
284 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
285 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
287 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
288 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
289 Null-terminator, then ASSERT().
291 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
293 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
294 @param FormatString A Null-terminated ASCII format string.
295 @param ... Variable argument list whose contents are accessed based on the
296 format string specified by FormatString.
298 @return The number of Unicode characters in the produced output buffer not including the
304 UnicodeSPrintAsciiFormat (
305 OUT CHAR16
*StartOfBuffer
,
307 IN CONST CHAR8
*FormatString
,
312 UINTN NumberOfPrinted
;
314 VA_START (Marker
, FormatString
);
315 NumberOfPrinted
= UnicodeVSPrintAsciiFormat (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
317 return NumberOfPrinted
;
321 Converts a decimal value to a Null-terminated Unicode string.
323 Converts the decimal number specified by Value to a Null-terminated Unicode
324 string specified by Buffer containing at most Width characters. No padding of spaces
325 is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
326 The number of Unicode characters in Buffer is returned not including the Null-terminator.
327 If the conversion contains more than Width characters, then only the first
328 Width characters are returned, and the total number of characters
329 required to perform the conversion is returned.
330 Additional conversion parameters are specified in Flags.
332 The Flags bit LEFT_JUSTIFY is always ignored.
333 All conversions are left justified in Buffer.
334 If Width is 0, PREFIX_ZERO is ignored in Flags.
335 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
336 are inserted every 3rd digit starting from the right.
337 If RADIX_HEX is set in Flags, then the output buffer will be
338 formatted in hexadecimal format.
339 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
340 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
341 then Buffer is padded with '0' characters so the combination of the optional '-'
342 sign character, '0' characters, digit characters for Value, and the Null-terminator
343 add up to Width characters.
344 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
345 If Buffer is NULL, then ASSERT().
346 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
347 If unsupported bits are set in Flags, then ASSERT().
348 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
349 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
351 @param Buffer The pointer to the output buffer for the produced Null-terminated
353 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
354 @param Value The 64-bit signed value to convert to a string.
355 @param Width The maximum number of Unicode characters to place in Buffer, not including
358 @return The number of Unicode characters in Buffer not including the Null-terminator.
363 UnicodeValueToString (
364 IN OUT CHAR16
*Buffer
,
370 ASSERT_UNICODE_BUFFER(Buffer
);
371 return BasePrintLibConvertValueToString ((CHAR8
*)Buffer
, Flags
, Value
, Width
, 2);
375 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
376 ASCII format string and a VA_LIST argument list.
378 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
380 The ASCII string is produced by parsing the format string specified by FormatString.
381 Arguments are pulled from the variable argument list specified by Marker based on
382 the contents of the format string.
383 The number of ASCII characters in the produced output buffer is returned not including
385 If BufferSize is 0, then no output buffer is produced and 0 is returned.
387 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
388 If BufferSize > 0 and FormatString is NULL, then ASSERT().
389 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
390 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
392 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
393 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
394 Null-terminator, then ASSERT().
396 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
398 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
399 @param FormatString A Null-terminated ASCII format string.
400 @param Marker VA_LIST marker for the variable argument list.
402 @return The number of ASCII characters in the produced output buffer not including the
409 OUT CHAR8
*StartOfBuffer
,
411 IN CONST CHAR8
*FormatString
,
415 return BasePrintLibSPrintMarker (StartOfBuffer
, BufferSize
, 0, FormatString
, Marker
, NULL
);
419 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
420 ASCII format string and a BASE_LIST argument list.
422 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
424 The ASCII string is produced by parsing the format string specified by FormatString.
425 Arguments are pulled from the variable argument list specified by Marker based on
426 the contents of the format string.
427 The number of ASCII characters in the produced output buffer is returned not including
429 If BufferSize is 0, then no output buffer is produced and 0 is returned.
431 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
432 If BufferSize > 0 and FormatString is NULL, then ASSERT().
433 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
434 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
436 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
437 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
438 Null-terminator, then ASSERT().
440 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
442 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
443 @param FormatString A Null-terminated ASCII format string.
444 @param Marker BASE_LIST marker for the variable argument list.
446 @return The number of ASCII characters in the produced output buffer not including the
453 OUT CHAR8
*StartOfBuffer
,
455 IN CONST CHAR8
*FormatString
,
459 return BasePrintLibSPrintMarker (StartOfBuffer
, BufferSize
, 0, FormatString
, gNullVaList
, Marker
);
463 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
464 ASCII format string and variable argument list.
466 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
468 The ASCII string is produced by parsing the format string specified by FormatString.
469 Arguments are pulled from the variable argument list based on the contents of the
471 The number of ASCII characters in the produced output buffer is returned not including
473 If BufferSize is 0, then no output buffer is produced and 0 is returned.
475 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
476 If BufferSize > 0 and FormatString is NULL, then ASSERT().
477 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
478 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
480 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
481 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
482 Null-terminator, then ASSERT().
484 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
486 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
487 @param FormatString A Null-terminated ASCII format string.
488 @param ... Variable argument list whose contents are accessed based on the
489 format string specified by FormatString.
491 @return The number of ASCII characters in the produced output buffer not including the
498 OUT CHAR8
*StartOfBuffer
,
500 IN CONST CHAR8
*FormatString
,
505 UINTN NumberOfPrinted
;
507 VA_START (Marker
, FormatString
);
508 NumberOfPrinted
= AsciiVSPrint (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
510 return NumberOfPrinted
;
514 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
515 Unicode format string and a VA_LIST argument list.
517 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
519 The ASCII string is produced by parsing the format string specified by FormatString.
520 Arguments are pulled from the variable argument list specified by Marker based on
521 the contents of the format string.
522 The number of ASCII characters in the produced output buffer is returned not including
524 If BufferSize is 0, then no output buffer is produced and 0 is returned.
526 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
527 If BufferSize > 0 and FormatString is NULL, then ASSERT().
528 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
529 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
530 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
532 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
533 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
534 Null-terminator, then ASSERT().
536 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
538 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
539 @param FormatString A Null-terminated Unicode format string.
540 @param Marker VA_LIST marker for the variable argument list.
542 @return The number of ASCII characters in the produced output buffer not including the
548 AsciiVSPrintUnicodeFormat (
549 OUT CHAR8
*StartOfBuffer
,
551 IN CONST CHAR16
*FormatString
,
555 ASSERT_UNICODE_BUFFER (FormatString
);
556 return BasePrintLibSPrintMarker (StartOfBuffer
, BufferSize
, FORMAT_UNICODE
, (CHAR8
*)FormatString
, Marker
, NULL
);
560 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
561 Unicode format string and a BASE_LIST argument list.
563 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
565 The ASCII string is produced by parsing the format string specified by FormatString.
566 Arguments are pulled from the variable argument list specified by Marker based on
567 the contents of the format string.
568 The number of ASCII characters in the produced output buffer is returned not including
570 If BufferSize is 0, then no output buffer is produced and 0 is returned.
572 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
573 If BufferSize > 0 and FormatString is NULL, then ASSERT().
574 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
575 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
576 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
578 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
579 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
580 Null-terminator, then ASSERT().
582 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
584 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
585 @param FormatString A Null-terminated Unicode format string.
586 @param Marker BASE_LIST marker for the variable argument list.
588 @return The number of ASCII characters in the produced output buffer not including the
594 AsciiBSPrintUnicodeFormat (
595 OUT CHAR8
*StartOfBuffer
,
597 IN CONST CHAR16
*FormatString
,
601 ASSERT_UNICODE_BUFFER (FormatString
);
602 return BasePrintLibSPrintMarker (StartOfBuffer
, BufferSize
, FORMAT_UNICODE
, (CHAR8
*)FormatString
, gNullVaList
, Marker
);
606 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
607 Unicode format string and variable argument list.
609 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
611 The ASCII string is produced by parsing the format string specified by FormatString.
612 Arguments are pulled from the variable argument list based on the contents of the
614 The number of ASCII characters in the produced output buffer is returned not including
616 If BufferSize is 0, then no output buffer is produced and 0 is returned.
618 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
619 If BufferSize > 0 and FormatString is NULL, then ASSERT().
620 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
621 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
622 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
624 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
625 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
626 Null-terminator, then ASSERT().
628 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
630 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
631 @param FormatString A Null-terminated Unicode format string.
632 @param ... Variable argument list whose contents are accessed based on the
633 format string specified by FormatString.
635 @return The number of ASCII characters in the produced output buffer not including the
641 AsciiSPrintUnicodeFormat (
642 OUT CHAR8
*StartOfBuffer
,
644 IN CONST CHAR16
*FormatString
,
649 UINTN NumberOfPrinted
;
651 VA_START (Marker
, FormatString
);
652 NumberOfPrinted
= AsciiVSPrintUnicodeFormat (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
654 return NumberOfPrinted
;
659 Converts a decimal value to a Null-terminated ASCII string.
661 Converts the decimal number specified by Value to a Null-terminated ASCII string
662 specified by Buffer containing at most Width characters. No padding of spaces
664 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
665 The number of ASCII characters in Buffer is returned not including the Null-terminator.
666 If the conversion contains more than Width characters, then only the first Width
667 characters are returned, and the total number of characters required to perform
668 the conversion is returned.
669 Additional conversion parameters are specified in Flags.
670 The Flags bit LEFT_JUSTIFY is always ignored.
671 All conversions are left justified in Buffer.
672 If Width is 0, PREFIX_ZERO is ignored in Flags.
673 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
674 are inserted every 3rd digit starting from the right.
675 If RADIX_HEX is set in Flags, then the output buffer will be
676 formatted in hexadecimal format.
677 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
678 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
679 then Buffer is padded with '0' characters so the combination of the optional '-'
680 sign character, '0' characters, digit characters for Value, and the Null-terminator
681 add up to Width characters.
683 If Buffer is NULL, then ASSERT().
684 If unsupported bits are set in Flags, then ASSERT().
685 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
686 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
688 @param Buffer The pointer to the output buffer for the produced Null-terminated
690 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
691 @param Value The 64-bit signed value to convert to a string.
692 @param Width The maximum number of ASCII characters to place in Buffer, not including
695 @return The number of ASCII characters in Buffer not including the Null-terminator.
707 return BasePrintLibConvertValueToString (Buffer
, Flags
, Value
, Width
, 1);
711 Returns the number of characters that would be produced by if the formatted
712 output were produced not including the Null-terminator.
714 If FormatString is NULL, then ASSERT().
715 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
717 @param[in] FormatString A Null-terminated Unicode format string.
718 @param[in] Marker VA_LIST marker for the variable argument list.
720 @return The number of characters that would be produced, not including the
726 IN CONST CHAR16
*FormatString
,
730 ASSERT(FormatString
!= NULL
);
731 ASSERT_UNICODE_BUFFER (FormatString
);
732 return BasePrintLibSPrintMarker (NULL
, 0, FORMAT_UNICODE
| OUTPUT_UNICODE
| COUNT_ONLY_NO_PRINT
, (CHAR8
*)FormatString
, Marker
, NULL
);
736 Returns the number of characters that would be produced by if the formatted
737 output were produced not including the Null-terminator.
739 If FormatString is NULL, then ASSERT().
741 @param[in] FormatString A Null-terminated ASCII format string.
742 @param[in] Marker VA_LIST marker for the variable argument list.
744 @return The number of characters that would be produced, not including the
749 SPrintLengthAsciiFormat (
750 IN CONST CHAR8
*FormatString
,
754 ASSERT(FormatString
!= NULL
);
755 return BasePrintLibSPrintMarker (NULL
, 0, OUTPUT_UNICODE
| COUNT_ONLY_NO_PRINT
, (CHAR8
*)FormatString
, Marker
, NULL
);