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.
17 #include "UefiLibInternal.h"
20 Internal function which prints a formatted Unicode string to the console output device
23 This function prints a formatted Unicode string to the console output device
24 specified by Console and returns the number of Unicode characters that printed
25 to it. If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize,
26 then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
27 If Format is NULL, then ASSERT().
28 If Format is not aligned on a 16-bit boundary, then ASSERT().
30 @param Format Null-terminated Unicode format string.
31 @param Console The output console.
32 @param Marker VA_LIST marker for the variable argument list.
34 @return The number of Unicode characters in the produced
35 output buffer not including the Null-terminator.
40 IN CONST CHAR16
*Format
,
41 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Console
,
49 ASSERT (Format
!= NULL
);
50 ASSERT (((UINTN
) Format
& 0x01) == 0);
52 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
54 Buffer
= (CHAR16
*) AllocatePool(BufferSize
);
55 ASSERT (Buffer
!= NULL
);
57 Return
= UnicodeVSPrint (Buffer
, BufferSize
, Format
, Marker
);
59 if (Console
!= NULL
&& Return
> 0) {
61 // To be extra safe make sure Console has been initialized
63 Console
->OutputString (Console
, Buffer
);
72 Prints a formatted Unicode string to the console output device specified by
73 ConOut defined in the EFI_SYSTEM_TABLE.
75 This function prints a formatted Unicode string to the console output device
76 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
77 characters that printed to ConOut. If the length of the formatted Unicode
78 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
79 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
80 If Format is NULL, then ASSERT().
81 If Format is not aligned on a 16-bit boundary, then ASSERT().
83 @param Format Null-terminated Unicode format string.
84 @param ... VARARG list consumed to process Format.
86 @return The number of Unicode characters in the produced
87 output buffer not including the Null-terminator.
93 IN CONST CHAR16
*Format
,
100 VA_START (Marker
, Format
);
102 Return
= InternalPrint (Format
, gST
->ConOut
, Marker
);
110 Prints a formatted Unicode string to the console output device specified by
111 StdErr defined in the EFI_SYSTEM_TABLE.
113 This function prints a formatted Unicode string to the console output device
114 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
115 characters that printed to StdErr. If the length of the formatted Unicode
116 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
117 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
118 If Format is NULL, then ASSERT().
119 If Format is not aligned on a 16-bit boundary, then ASSERT().
121 @param Format Null-terminated Unicode format string.
122 @param ... VARARG list consumed to process Format.
124 @return The number of Unicode characters in the produced
125 output buffer not including the Null-terminator.
130 IN CONST CHAR16
*Format
,
137 VA_START (Marker
, Format
);
139 Return
= InternalPrint( Format
, gST
->StdErr
, Marker
);
148 Internal function which prints a formatted ASCII string to the console output device
151 This function prints a formatted ASCII string to the console output device
152 specified by Console and returns the number of ASCII characters that printed
153 to it. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize,
154 then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
155 If Format is NULL, then ASSERT().
157 If Format is NULL, then ASSERT().
158 If Format is not aligned on a 16-bit boundary, then ASSERT().
161 @param Format Null-terminated ASCII format string.
162 @param Console The output console.
163 @param Marker VA_LIST marker for the variable argument list.
165 @return The number of Unicode characters in the produced
166 output buffer not including the Null-terminator.
172 IN CONST CHAR8
*Format
,
173 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Console
,
181 ASSERT (Format
!= NULL
);
183 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
185 Buffer
= (CHAR16
*) AllocatePool(BufferSize
);
186 ASSERT (Buffer
!= NULL
);
188 Return
= UnicodeVSPrintAsciiFormat (Buffer
, BufferSize
, Format
, Marker
);
190 if (Console
!= NULL
) {
192 // To be extra safe make sure Console has been initialized
194 Console
->OutputString (Console
, Buffer
);
203 Prints a formatted ASCII string to the console output device specified by
204 ConOut defined in the EFI_SYSTEM_TABLE.
206 This function prints a formatted ASCII string to the console output device
207 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
208 characters that printed to ConOut. If the length of the formatted ASCII
209 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
210 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
211 If Format is NULL, then ASSERT().
213 @param Format Null-terminated ASCII format string.
214 @param ... VARARG list consumed to process Format.
216 @return The number of Ascii characters in the produced
217 output buffer not including the Null-terminator.
223 IN CONST CHAR8
*Format
,
229 ASSERT (Format
!= NULL
);
231 VA_START (Marker
, Format
);
233 Return
= AsciiInternalPrint( Format
, gST
->ConOut
, Marker
);
241 Prints a formatted ASCII string to the console output device specified by
242 StdErr defined in the EFI_SYSTEM_TABLE.
244 This function prints a formatted ASCII string to the console output device
245 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
246 characters that printed to StdErr. If the length of the formatted ASCII
247 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
248 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
249 If Format is NULL, then ASSERT().
251 @param Format Null-terminated ASCII format string.
252 @param ... VARARG list consumed to process Format.
254 @return The number of Ascii characters in the produced output
255 buffer not including the Null-terminator.
261 IN CONST CHAR8
*Format
,
268 ASSERT (Format
!= NULL
);
270 VA_START (Marker
, Format
);
272 Return
= AsciiInternalPrint( Format
, gST
->StdErr
, Marker
);