2 Instance of Print Library based on gEfiPrint2ProtocolGuid.
4 Implement the print library instance by wrap the interface
5 provided in the Print2 protocol. This protocol is defined as the internal
6 protocol related to this implementation, not in the public spec. So, this
7 library instance is only for this code base.
9 Copyright (c) 2009, Intel Corporation
10 All rights reserved. This program and the accompanying materials
11 are licensed and made available under the terms and conditions of the BSD License
12 which accompanies this distribution. The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
22 #include <Protocol/Print2.h>
24 #include <Library/PrintLib.h>
26 #include <Library/BaseLib.h>
27 #include <Library/UefiBootServicesTableLib.h>
28 #include <Library/DebugLib.h>
30 EFI_PRINT2_PROTOCOL
*mPrint2Protocol
= NULL
;
33 The constructor function caches the pointer to Print2 protocol.
35 The constructor function locates Print2 protocol from protocol database.
36 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
38 @param ImageHandle The firmware allocated handle for the EFI image.
39 @param SystemTable A pointer to the EFI System Table.
41 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
47 IN EFI_HANDLE ImageHandle
,
48 IN EFI_SYSTEM_TABLE
*SystemTable
53 Status
= gBS
->LocateProtocol (
54 &gEfiPrint2ProtocolGuid
,
56 (VOID
**) &mPrint2Protocol
58 ASSERT_EFI_ERROR (Status
);
59 ASSERT (mPrint2Protocol
!= NULL
);
66 Worker function that converts a VA_LIST to a BASE_LIST based on a Null-terminated
69 @param AsciiFormat TRUE if Format is an ASCII string. FALSE if Format is a Unicode string.
70 @param Format Null-terminated format string.
71 @param VaListMarker VA_LIST style variable argument list consumed by processing Format.
72 @param BaseListMarker BASE_LIST style variable argument list consumed by processing Format.
73 @param Size The size, in bytes, of the BaseListMarker buffer.
75 @return The number of bytes in BaseListMarker. 0 if BaseListMarker is too small.
79 DxePrintLibPrint2ProtocolVaListToBaseList (
80 IN BOOLEAN AsciiFormat
,
81 IN CONST CHAR8
*Format
,
82 IN VA_LIST VaListMarker
,
83 OUT BASE_LIST BaseListMarker
,
87 BASE_LIST BaseListStart
;
88 UINTN BytesPerFormatCharacter
;
90 UINTN FormatCharacter
;
94 ASSERT (Format
!= NULL
);
95 ASSERT (VaListMarker
!= NULL
);
96 ASSERT (BaseListMarker
!= NULL
);
98 BaseListStart
= BaseListMarker
;
101 ASSERT (AsciiStrSize (Format
) != 0);
102 BytesPerFormatCharacter
= 1;
105 ASSERT (StrSize ((CHAR16
*) Format
) != 0);
106 BytesPerFormatCharacter
= 2;
111 // Get the first character from the format string
113 FormatCharacter
= ((*Format
& 0xff) | (*(Format
+ 1) << 8)) & FormatMask
;
115 while (FormatCharacter
!= 0) {
116 if (FormatCharacter
== '%') {
120 // Parse Flags and Width
122 for (Done
= FALSE
; !Done
; ) {
124 // Get the next character from the format string
126 Format
+= BytesPerFormatCharacter
;
129 // Get the next character from the format string
131 FormatCharacter
= ((*Format
& 0xff) | (*(Format
+ 1) << 8)) & FormatMask
;
133 switch (FormatCharacter
) {
155 BASE_ARG (BaseListMarker
, UINTN
) = VA_ARG (VaListMarker
, UINTN
);
159 // Make no output if Format string terminates unexpectedly when
160 // looking up for flag, width, precision and type.
162 Format
-= BytesPerFormatCharacter
;
164 // break skipped on purpose.
173 // Handle each argument type
175 switch (FormatCharacter
) {
177 if (sizeof (VOID
*) > 4) {
184 BASE_ARG (BaseListMarker
, INT64
) = VA_ARG (VaListMarker
, INT64
);
186 BASE_ARG (BaseListMarker
, int) = VA_ARG (VaListMarker
, int);
194 BASE_ARG (BaseListMarker
, VOID
*) = VA_ARG (VaListMarker
, VOID
*);
197 BASE_ARG (BaseListMarker
, UINTN
) = VA_ARG (VaListMarker
, UINTN
);
200 BASE_ARG (BaseListMarker
, RETURN_STATUS
) = VA_ARG (VaListMarker
, RETURN_STATUS
);
206 // If BASE_LIST is larger than Size, then return FALSE
208 if ((UINTN
)((UINT8
*)BaseListMarker
- (UINT8
*)BaseListStart
) > Size
) {
213 // Get the next character from the format string
215 Format
+= BytesPerFormatCharacter
;
218 // Get the next character from the format string
220 FormatCharacter
= ((*Format
& 0xff) | (*(Format
+ 1) << 8)) & FormatMask
;
226 Produces a Null-terminated Unicode string in an output buffer based on
227 a Null-terminated Unicode format string and a VA_LIST argument list
229 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
231 The Unicode string is produced by parsing the format string specified by FormatString.
232 Arguments are pulled from the variable argument list specified by Marker based on the
233 contents of the format string.
234 The number of Unicode characters in the produced output buffer is returned not including
236 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
238 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
239 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
240 If BufferSize > 1 and FormatString is NULL, then ASSERT().
241 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
242 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
243 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
245 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
246 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
247 Null-terminator, then ASSERT().
249 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
251 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
252 @param FormatString Null-terminated Unicode format string.
253 @param Marker VA_LIST marker for the variable argument list.
255 @return The number of Unicode characters in the produced output buffer not including the
262 OUT CHAR16
*StartOfBuffer
,
264 IN CONST CHAR16
*FormatString
,
268 UINT8 BaseListMarker
[256];
270 DxePrintLibPrint2ProtocolVaListToBaseList (
272 (CHAR8
*)FormatString
,
274 (BASE_LIST
)BaseListMarker
,
275 sizeof (BaseListMarker
) - 8
278 return UnicodeBSPrint (StartOfBuffer
, BufferSize
, FormatString
, (BASE_LIST
)BaseListMarker
);
282 Produces a Null-terminated Unicode string in an output buffer based on
283 a Null-terminated Unicode format string and a BASE_LIST argument list
285 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
287 The Unicode string is produced by parsing the format string specified by FormatString.
288 Arguments are pulled from the variable argument list specified by Marker based on the
289 contents of the format string.
290 The number of Unicode characters in the produced output buffer is returned not including
292 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
294 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
295 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
296 If BufferSize > 1 and FormatString is NULL, then ASSERT().
297 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
298 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
299 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
301 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
302 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
303 Null-terminator, then ASSERT().
305 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
307 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
308 @param FormatString Null-terminated Unicode format string.
309 @param Marker BASE_LIST marker for the variable argument list.
311 @return The number of Unicode characters in the produced output buffer not including the
318 OUT CHAR16
*StartOfBuffer
,
320 IN CONST CHAR16
*FormatString
,
324 return mPrint2Protocol
->UnicodeBSPrint (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
328 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
329 Unicode format string and variable argument list.
331 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
333 The Unicode string is produced by parsing the format string specified by FormatString.
334 Arguments are pulled from the variable argument list based on the contents of the format string.
335 The number of Unicode characters in the produced output buffer is returned not including
337 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
339 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
340 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
341 If BufferSize > 1 and FormatString is NULL, then ASSERT().
342 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
343 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
344 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
346 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
347 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
348 Null-terminator, then ASSERT().
350 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
352 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
353 @param FormatString Null-terminated Unicode format string.
354 @param ... Variable argument list whose contents are accessed based on the
355 format string specified by FormatString.
357 @return The number of Unicode characters in the produced output buffer not including the
364 OUT CHAR16
*StartOfBuffer
,
366 IN CONST CHAR16
*FormatString
,
372 VA_START (Marker
, FormatString
);
373 return UnicodeVSPrint (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
377 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
378 ASCII format string and a VA_LIST argument list
380 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
382 The Unicode string is produced by parsing the format string specified by FormatString.
383 Arguments are pulled from the variable argument list specified by Marker based on the
384 contents of the format string.
385 The number of Unicode characters in the produced output buffer is returned not including
387 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
389 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
390 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
391 If BufferSize > 1 and FormatString is NULL, then ASSERT().
392 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
393 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
395 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
396 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
397 Null-terminator, then ASSERT().
399 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
401 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
402 @param FormatString Null-terminated Unicode format string.
403 @param Marker VA_LIST marker for the variable argument list.
405 @return The number of Unicode characters in the produced output buffer not including the
411 UnicodeVSPrintAsciiFormat (
412 OUT CHAR16
*StartOfBuffer
,
414 IN CONST CHAR8
*FormatString
,
418 UINT8 BaseListMarker
[256];
420 DxePrintLibPrint2ProtocolVaListToBaseList (
424 (BASE_LIST
)BaseListMarker
,
425 sizeof (BaseListMarker
) - 8
428 return UnicodeBSPrintAsciiFormat (StartOfBuffer
, BufferSize
, FormatString
, (BASE_LIST
)BaseListMarker
);
432 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
433 ASCII format string and a BASE_LIST argument list
435 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
437 The Unicode string is produced by parsing the format string specified by FormatString.
438 Arguments are pulled from the variable argument list specified by Marker based on the
439 contents of the format string.
440 The number of Unicode characters in the produced output buffer is returned not including
442 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
444 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
445 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
446 If BufferSize > 1 and FormatString is NULL, then ASSERT().
447 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
448 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
450 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
451 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
452 Null-terminator, then ASSERT().
454 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
456 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
457 @param FormatString Null-terminated Unicode format string.
458 @param Marker BASE_LIST marker for the variable argument list.
460 @return The number of Unicode characters in the produced output buffer not including the
466 UnicodeBSPrintAsciiFormat (
467 OUT CHAR16
*StartOfBuffer
,
469 IN CONST CHAR8
*FormatString
,
473 return mPrint2Protocol
->UnicodeBSPrintAsciiFormat (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
477 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
478 ASCII format string and variable argument list.
480 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
482 The Unicode string is produced by parsing the format string specified by FormatString.
483 Arguments are pulled from the variable argument list based on the contents of the
485 The number of Unicode characters in the produced output buffer is returned not including
487 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
489 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
490 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
491 If BufferSize > 1 and FormatString is NULL, then ASSERT().
492 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
493 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
495 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
496 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
497 Null-terminator, then ASSERT().
499 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
501 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
502 @param FormatString Null-terminated Unicode format string.
503 @param ... Variable argument list whose contents are accessed based on the
504 format string specified by FormatString.
506 @return The number of Unicode characters in the produced output buffer not including the
512 UnicodeSPrintAsciiFormat (
513 OUT CHAR16
*StartOfBuffer
,
515 IN CONST CHAR8
*FormatString
,
521 VA_START (Marker
, FormatString
);
522 return UnicodeVSPrintAsciiFormat (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
526 Converts a decimal value to a Null-terminated Unicode string.
528 Converts the decimal number specified by Value to a Null-terminated Unicode
529 string specified by Buffer containing at most Width characters. No padding of spaces
530 is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
531 The number of Unicode characters in Buffer is returned not including the Null-terminator.
532 If the conversion contains more than Width characters, then only the first
533 Width characters are returned, and the total number of characters
534 required to perform the conversion is returned.
535 Additional conversion parameters are specified in Flags.
537 The Flags bit LEFT_JUSTIFY is always ignored.
538 All conversions are left justified in Buffer.
539 If Width is 0, PREFIX_ZERO is ignored in Flags.
540 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
541 are inserted every 3rd digit starting from the right.
542 If HEX_RADIX is set in Flags, then the output buffer will be
543 formatted in hexadecimal format.
544 If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.
545 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
546 then Buffer is padded with '0' characters so the combination of the optional '-'
547 sign character, '0' characters, digit characters for Value, and the Null-terminator
548 add up to Width characters.
549 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
550 If Buffer is NULL, then ASSERT().
551 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
552 If unsupported bits are set in Flags, then ASSERT().
553 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
554 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
556 @param Buffer Pointer to the output buffer for the produced Null-terminated
558 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
559 @param Value The 64-bit signed value to convert to a string.
560 @param Width The maximum number of Unicode characters to place in Buffer, not including
563 @return The number of Unicode characters in Buffer not including the Null-terminator.
568 UnicodeValueToString (
569 IN OUT CHAR16
*Buffer
,
575 return mPrint2Protocol
->UnicodeValueToString (Buffer
, Flags
, Value
, Width
);
579 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
580 ASCII format string and a VA_LIST argument list.
582 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
584 The ASCII string is produced by parsing the format string specified by FormatString.
585 Arguments are pulled from the variable argument list specified by Marker based on
586 the contents of the format string.
587 The number of ASCII characters in the produced output buffer is returned not including
589 If BufferSize is 0, then no output buffer is produced and 0 is returned.
591 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
592 If BufferSize > 0 and FormatString is NULL, then ASSERT().
593 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
594 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
596 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
597 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
598 Null-terminator, then ASSERT().
600 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
602 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
603 @param FormatString Null-terminated Unicode format string.
604 @param Marker VA_LIST marker for the variable argument list.
606 @return The number of ASCII characters in the produced output buffer not including the
613 OUT CHAR8
*StartOfBuffer
,
615 IN CONST CHAR8
*FormatString
,
619 UINT8 BaseListMarker
[256];
621 DxePrintLibPrint2ProtocolVaListToBaseList (
625 (BASE_LIST
)BaseListMarker
,
626 sizeof (BaseListMarker
) - 8
629 return AsciiBSPrint (StartOfBuffer
, BufferSize
, FormatString
, (BASE_LIST
)BaseListMarker
);
633 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
634 ASCII format string and a BASE_LIST argument list.
636 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
638 The ASCII string is produced by parsing the format string specified by FormatString.
639 Arguments are pulled from the variable argument list specified by Marker based on
640 the contents of the format string.
641 The number of ASCII characters in the produced output buffer is returned not including
643 If BufferSize is 0, then no output buffer is produced and 0 is returned.
645 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
646 If BufferSize > 0 and FormatString is NULL, then ASSERT().
647 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
648 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
650 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
651 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
652 Null-terminator, then ASSERT().
654 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
656 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
657 @param FormatString Null-terminated Unicode format string.
658 @param Marker BASE_LIST marker for the variable argument list.
660 @return The number of ASCII characters in the produced output buffer not including the
667 OUT CHAR8
*StartOfBuffer
,
669 IN CONST CHAR8
*FormatString
,
673 return mPrint2Protocol
->AsciiBSPrint (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
677 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
678 ASCII format string and variable argument list.
680 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
682 The ASCII string is produced by parsing the format string specified by FormatString.
683 Arguments are pulled from the variable argument list based on the contents of the
685 The number of ASCII characters in the produced output buffer is returned not including
687 If BufferSize is 0, then no output buffer is produced and 0 is returned.
689 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
690 If BufferSize > 0 and FormatString is NULL, then ASSERT().
691 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
692 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
694 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
695 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
696 Null-terminator, then ASSERT().
698 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
700 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
701 @param FormatString Null-terminated Unicode format string.
702 @param ... Variable argument list whose contents are accessed based on the
703 format string specified by FormatString.
705 @return The number of ASCII characters in the produced output buffer not including the
712 OUT CHAR8
*StartOfBuffer
,
714 IN CONST CHAR8
*FormatString
,
720 VA_START (Marker
, FormatString
);
721 return AsciiVSPrint (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
725 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
726 ASCII format string and a VA_LIST argument list.
728 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
730 The ASCII string is produced by parsing the format string specified by FormatString.
731 Arguments are pulled from the variable argument list specified by Marker based on
732 the contents of the format string.
733 The number of ASCII characters in the produced output buffer is returned not including
735 If BufferSize is 0, then no output buffer is produced and 0 is returned.
737 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
738 If BufferSize > 0 and FormatString is NULL, then ASSERT().
739 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
740 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
741 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
743 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
744 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
745 Null-terminator, then ASSERT().
747 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
749 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
750 @param FormatString Null-terminated Unicode format string.
751 @param Marker VA_LIST marker for the variable argument list.
753 @return The number of ASCII characters in the produced output buffer not including the
759 AsciiVSPrintUnicodeFormat (
760 OUT CHAR8
*StartOfBuffer
,
762 IN CONST CHAR16
*FormatString
,
766 UINT8 BaseListMarker
[256];
768 DxePrintLibPrint2ProtocolVaListToBaseList (
770 (CHAR8
*)FormatString
,
772 (BASE_LIST
)BaseListMarker
,
773 sizeof (BaseListMarker
) - 8
776 return AsciiBSPrintUnicodeFormat (StartOfBuffer
, BufferSize
, FormatString
, (BASE_LIST
)BaseListMarker
);
780 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
781 ASCII format string and a BASE_LIST argument list.
783 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
785 The ASCII string is produced by parsing the format string specified by FormatString.
786 Arguments are pulled from the variable argument list specified by Marker based on
787 the contents of the format string.
788 The number of ASCII characters in the produced output buffer is returned not including
790 If BufferSize is 0, then no output buffer is produced and 0 is returned.
792 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
793 If BufferSize > 0 and FormatString is NULL, then ASSERT().
794 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
795 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
796 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
798 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
799 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
800 Null-terminator, then ASSERT().
802 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
804 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
805 @param FormatString Null-terminated Unicode format string.
806 @param Marker BASE_LIST marker for the variable argument list.
808 @return The number of ASCII characters in the produced output buffer not including the
814 AsciiBSPrintUnicodeFormat (
815 OUT CHAR8
*StartOfBuffer
,
817 IN CONST CHAR16
*FormatString
,
821 return mPrint2Protocol
->AsciiBSPrintUnicodeFormat (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
825 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
826 ASCII format string and variable argument list.
828 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
830 The ASCII string is produced by parsing the format string specified by FormatString.
831 Arguments are pulled from the variable argument list based on the contents of the
833 The number of ASCII characters in the produced output buffer is returned not including
835 If BufferSize is 0, then no output buffer is produced and 0 is returned.
837 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
838 If BufferSize > 0 and FormatString is NULL, then ASSERT().
839 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
840 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
841 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
843 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
844 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
845 Null-terminator, then ASSERT().
847 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
849 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
850 @param FormatString Null-terminated Unicode format string.
851 @param ... Variable argument list whose contents are accessed based on the
852 format string specified by FormatString.
854 @return The number of ASCII characters in the produced output buffer not including the
860 AsciiSPrintUnicodeFormat (
861 OUT CHAR8
*StartOfBuffer
,
863 IN CONST CHAR16
*FormatString
,
869 VA_START (Marker
, FormatString
);
870 return AsciiVSPrintUnicodeFormat (StartOfBuffer
, BufferSize
, FormatString
, Marker
);
875 Converts a decimal value to a Null-terminated ASCII string.
877 Converts the decimal number specified by Value to a Null-terminated ASCII string
878 specified by Buffer containing at most Width characters. No padding of spaces
880 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
881 The number of ASCII characters in Buffer is returned not including the Null-terminator.
882 If the conversion contains more than Width characters, then only the first Width
883 characters are returned, and the total number of characters required to perform
884 the conversion is returned.
885 Additional conversion parameters are specified in Flags.
886 The Flags bit LEFT_JUSTIFY is always ignored.
887 All conversions are left justified in Buffer.
888 If Width is 0, PREFIX_ZERO is ignored in Flags.
889 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
890 are inserted every 3rd digit starting from the right.
891 If HEX_RADIX is set in Flags, then the output buffer will be
892 formatted in hexadecimal format.
893 If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.
894 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
895 then Buffer is padded with '0' characters so the combination of the optional '-'
896 sign character, '0' characters, digit characters for Value, and the Null-terminator
897 add up to Width characters.
899 If Buffer is NULL, then ASSERT().
900 If unsupported bits are set in Flags, then ASSERT().
901 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().
902 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
904 @param Buffer Pointer to the output buffer for the produced Null-terminated
906 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
907 @param Value The 64-bit signed value to convert to a string.
908 @param Width The maximum number of ASCII characters to place in Buffer, not including
911 @return The number of ASCII characters in Buffer not including the Null-terminator.
923 return mPrint2Protocol
->AsciiValueToString (Buffer
, Flags
, Value
, Width
);