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.
131 IN CONST CHAR16
*Format
,
138 VA_START (Marker
, Format
);
140 Return
= InternalPrint( Format
, gST
->StdErr
, Marker
);
149 Internal function which prints a formatted ASCII string to the console output device
152 This function prints a formatted ASCII string to the console output device
153 specified by Console and returns the number of ASCII characters that printed
154 to it. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize,
155 then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
156 If Format is NULL, then ASSERT().
158 If Format is NULL, then ASSERT().
159 If Format is not aligned on a 16-bit boundary, then ASSERT().
162 @param Format Null-terminated ASCII format string.
163 @param Console The output console.
164 @param Marker VA_LIST marker for the variable argument list.
166 @return The number of Unicode characters in the produced
167 output buffer not including the Null-terminator.
173 IN CONST CHAR8
*Format
,
174 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Console
,
182 ASSERT (Format
!= NULL
);
184 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
186 Buffer
= (CHAR16
*) AllocatePool(BufferSize
);
187 ASSERT (Buffer
!= NULL
);
189 Return
= UnicodeVSPrintAsciiFormat (Buffer
, BufferSize
, Format
, Marker
);
191 if (Console
!= NULL
) {
193 // To be extra safe make sure Console has been initialized
195 Console
->OutputString (Console
, Buffer
);
204 Prints a formatted ASCII string to the console output device specified by
205 ConOut defined in the EFI_SYSTEM_TABLE.
207 This function prints a formatted ASCII string to the console output device
208 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
209 characters that printed to ConOut. If the length of the formatted ASCII
210 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
211 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
212 If Format is NULL, then ASSERT().
214 @param Format Null-terminated ASCII format string.
215 @param ... VARARG list consumed to process Format.
217 @return The number of Ascii characters in the produced
218 output buffer not including the Null-terminator.
224 IN CONST CHAR8
*Format
,
230 ASSERT (Format
!= NULL
);
232 VA_START (Marker
, Format
);
234 Return
= AsciiInternalPrint( Format
, gST
->ConOut
, Marker
);
242 Prints a formatted ASCII string to the console output device specified by
243 StdErr defined in the EFI_SYSTEM_TABLE.
245 This function prints a formatted ASCII string to the console output device
246 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
247 characters that printed to StdErr. If the length of the formatted ASCII
248 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
249 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
250 If Format is NULL, then ASSERT().
252 @param Format Null-terminated ASCII format string.
253 @param ... VARARG list consumed to process Format.
255 @return The number of Ascii characters in the produced output
256 buffer not including the Null-terminator.
262 IN CONST CHAR8
*Format
,
269 ASSERT (Format
!= NULL
);
271 VA_START (Marker
, Format
);
273 Return
= AsciiInternalPrint( Format
, gST
->StdErr
, Marker
);