2 Mde UEFI library API implemention.
3 Print to StdErr or ConOut defined in EFI_SYSTEM_TABLE
5 Copyright (c) 2007, Intel Corporation<BR>
6 All rights reserved. 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 "FrameworkUefiLib.h"
19 Internal function which prints a formatted Unicode string to the console output device
22 This function prints a formatted Unicode string to the console output device
23 specified by Console and returns the number of Unicode characters that printed
24 to it. If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize,
25 then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
27 @param Format Null-terminated Unicode format string.
28 @param Console The output console.
29 @param Marker VA_LIST marker for the variable argument list.
31 If Format is NULL, then ASSERT().
32 If Format is not aligned on a 16-bit boundary, then ASSERT().
38 IN CONST CHAR16
*Format
,
39 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Console
,
47 ASSERT (Format
!= NULL
);
48 ASSERT (((UINTN
) Format
& 0x01) == 0);
50 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
52 Buffer
= (CHAR16
*) AllocatePool(BufferSize
);
53 ASSERT (Buffer
!= NULL
);
55 Return
= UnicodeVSPrint (Buffer
, BufferSize
, Format
, Marker
);
57 if (Console
!= NULL
) {
59 // To be extra safe make sure Console has been initialized
61 Console
->OutputString (Console
, Buffer
);
70 Prints a formatted Unicode string to the console output device specified by
71 ConOut defined in the EFI_SYSTEM_TABLE.
73 This function prints a formatted Unicode string to the console output device
74 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
75 characters that printed to ConOut. If the length of the formatted Unicode
76 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
77 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
79 @param Format Null-terminated Unicode format string.
80 @param ... Variable argument list whose contents are accessed based
81 on the format string specified by Format.
82 If Format is NULL, then ASSERT().
83 If Format is not aligned on a 16-bit boundary, then ASSERT().
89 IN CONST CHAR16
*Format
,
96 VA_START (Marker
, Format
);
98 Return
= InternalPrint (Format
, gST
->ConOut
, Marker
);
106 Prints a formatted Unicode string to the console output device specified by
107 StdErr defined in the EFI_SYSTEM_TABLE.
109 This function prints a formatted Unicode string to the console output device
110 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
111 characters that printed to StdErr. If the length of the formatted Unicode
112 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
113 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
115 @param Format Null-terminated Unicode format string.
116 @param ... Variable argument list whose contents are accessed based
117 on the format string specified by Format.
118 If Format is NULL, then ASSERT().
119 If Format is not aligned on a 16-bit boundary, then ASSERT().
126 IN CONST CHAR16
*Format
,
133 VA_START (Marker
, Format
);
135 Return
= InternalPrint( Format
, gST
->StdErr
, Marker
);
144 Internal function which prints a formatted ASCII string to the console output device
147 This function prints a formatted ASCII string to the console output device
148 specified by Console and returns the number of ASCII characters that printed
149 to it. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize,
150 then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
152 @param Format Null-terminated ASCII format string.
153 @param Console The output console.
154 @param Marker VA_LIST marker for the variable argument list.
156 If Format is NULL, then ASSERT().
162 IN CONST CHAR8
*Format
,
163 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Console
,
171 ASSERT (Format
!= NULL
);
173 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
175 Buffer
= (CHAR16
*) AllocatePool(BufferSize
);
176 ASSERT (Buffer
!= NULL
);
178 Return
= UnicodeVSPrintAsciiFormat (Buffer
, BufferSize
, Format
, Marker
);
180 if (Console
!= NULL
) {
182 // To be extra safe make sure Console has been initialized
184 Console
->OutputString (Console
, Buffer
);
193 Prints a formatted ASCII string to the console output device specified by
194 ConOut defined in the EFI_SYSTEM_TABLE.
196 This function prints a formatted ASCII string to the console output device
197 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
198 characters that printed to ConOut. If the length of the formatted ASCII
199 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
200 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
202 @param Format Null-terminated ASCII format string.
203 @param ... Variable argument list whose contents are accessed based
204 on the format string specified by Format.
205 If Format is NULL, then ASSERT().
206 If Format is not aligned on a 16-bit boundary, then ASSERT().
212 IN CONST CHAR8
*Format
,
219 VA_START (Marker
, Format
);
221 Return
= AsciiInternalPrint( Format
, gST
->ConOut
, Marker
);
229 Prints a formatted ASCII string to the console output device specified by
230 StdErr defined in the EFI_SYSTEM_TABLE.
232 This function prints a formatted ASCII string to the console output device
233 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
234 characters that printed to StdErr. If the length of the formatted ASCII
235 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
236 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
238 @param Format Null-terminated ASCII format string.
239 @param ... Variable argument list whose contents are accessed based
240 on the format string specified by Format.
241 If Format is NULL, then ASSERT().
242 If Format is not aligned on a 16-bit boundary, then ASSERT().
248 IN CONST CHAR8
*Format
,
255 VA_START (Marker
, Format
);
257 Return
= AsciiInternalPrint( Format
, gST
->StdErr
, Marker
);