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 Internal function which prints a formatted Unicode string to the console output device
20 This function prints a formatted Unicode string to the console output device
21 specified by Console and returns the number of Unicode characters that printed
22 to it. If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize,
23 then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
25 @param Format Null-terminated Unicode format string.
26 @param Console The output console.
27 @param Marker VA_LIST marker for the variable argument list.
29 If Format is NULL, then ASSERT().
30 If Format is not aligned on a 16-bit boundary, then ASSERT().
37 IN CONST CHAR16
*Format
,
38 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL
*Console
,
46 ASSERT (Format
!= NULL
);
47 ASSERT (((UINTN
) Format
& 0x01) == 0);
49 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
51 Buffer
= (CHAR16
*) AllocatePool(BufferSize
);
52 ASSERT (Buffer
!= NULL
);
54 Return
= UnicodeVSPrint (Buffer
, BufferSize
, Format
, Marker
);
56 if (Console
!= NULL
) {
58 // To be extra safe make sure Console has been initialized
60 Console
->OutputString (Console
, Buffer
);
69 Prints a formatted Unicode string to the console output device specified by
70 ConOut defined in the EFI_SYSTEM_TABLE.
72 This function prints a formatted Unicode string to the console output device
73 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
74 characters that printed to ConOut. If the length of the formatted Unicode
75 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
76 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
78 @param Format Null-terminated Unicode format string.
79 @param ... VARARG list consumed to process Format.
80 If Format is NULL, then ASSERT().
81 If Format is not aligned on a 16-bit boundary, then ASSERT().
87 IN CONST CHAR16
*Format
,
94 VA_START (Marker
, Format
);
96 Return
= InternalPrint (Format
, gST
->ConOut
, Marker
);
104 Prints a formatted Unicode string to the console output device specified by
105 StdErr defined in the EFI_SYSTEM_TABLE.
107 This function prints a formatted Unicode string to the console output device
108 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
109 characters that printed to StdErr. If the length of the formatted Unicode
110 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
111 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
113 @param Format Null-terminated Unicode format string.
114 @param ... VARARG list consumed to process Format.
115 If Format is NULL, then ASSERT().
116 If Format is not aligned on a 16-bit boundary, then ASSERT().
123 IN CONST CHAR16
*Format
,
130 VA_START (Marker
, Format
);
132 Return
= InternalPrint( Format
, gST
->StdErr
, Marker
);
141 Internal function which prints a formatted ASCII string to the console output device
144 This function prints a formatted ASCII string to the console output device
145 specified by Console and returns the number of ASCII characters that printed
146 to it. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize,
147 then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
149 @param Format Null-terminated ASCII format string.
150 @param Console The output console.
151 @param Marker VA_LIST marker for the variable argument list.
153 If Format is NULL, then ASSERT().
160 IN CONST CHAR8
*Format
,
161 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL
*Console
,
169 ASSERT (Format
!= NULL
);
171 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
173 Buffer
= (CHAR16
*) AllocatePool(BufferSize
);
174 ASSERT (Buffer
!= NULL
);
176 Return
= UnicodeVSPrintAsciiFormat (Buffer
, BufferSize
, Format
, Marker
);
178 if (Console
!= NULL
) {
180 // To be extra safe make sure Console has been initialized
182 Console
->OutputString (Console
, Buffer
);
191 Prints a formatted ASCII string to the console output device specified by
192 ConOut defined in the EFI_SYSTEM_TABLE.
194 This function prints a formatted ASCII string to the console output device
195 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
196 characters that printed to ConOut. If the length of the formatted ASCII
197 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
198 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
200 @param Format Null-terminated ASCII format string.
201 @param ... VARARG list consumed to process Format.
202 If Format is NULL, then ASSERT().
203 If Format is not aligned on a 16-bit boundary, then ASSERT().
209 IN CONST CHAR8
*Format
,
216 VA_START (Marker
, Format
);
218 Return
= AsciiInternalPrint( Format
, gST
->ConOut
, Marker
);
226 Prints a formatted ASCII string to the console output device specified by
227 StdErr defined in the EFI_SYSTEM_TABLE.
229 This function prints a formatted ASCII string to the console output device
230 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
231 characters that printed to StdErr. If the length of the formatted ASCII
232 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
233 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
235 @param Format Null-terminated ASCII format string.
236 @param ... VARARG list consumed to process Format.
237 If Format is NULL, then ASSERT().
238 If Format is not aligned on a 16-bit boundary, then ASSERT().
244 IN CONST CHAR8
*Format
,
251 VA_START (Marker
, Format
);
253 Return
= AsciiInternalPrint( Format
, gST
->StdErr
, Marker
);