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 "UefiLibFramework.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().
39 IN CONST CHAR16
*Format
,
40 IN EFI_SIMPLE_TEXT_OUT_PROTOCOL
*Console
,
48 ASSERT (Format
!= NULL
);
49 ASSERT (((UINTN
) Format
& 0x01) == 0);
51 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
53 Buffer
= (CHAR16
*) AllocatePool(BufferSize
);
54 ASSERT (Buffer
!= NULL
);
56 Return
= UnicodeVSPrint (Buffer
, BufferSize
, Format
, Marker
);
58 if (Console
!= NULL
) {
60 // To be extra safe make sure Console has been initialized
62 Console
->OutputString (Console
, Buffer
);
71 Prints a formatted Unicode string to the console output device specified by
72 ConOut defined in the EFI_SYSTEM_TABLE.
74 This function prints a formatted Unicode string to the console output device
75 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
76 characters that printed to ConOut. If the length of the formatted Unicode
77 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
78 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
80 @param Format Null-terminated Unicode format string.
81 @param ... VARARG list consumed to process 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 ... VARARG list consumed to process Format.
117 If Format is NULL, then ASSERT().
118 If Format is not aligned on a 16-bit boundary, then ASSERT().
125 IN CONST CHAR16
*Format
,
132 VA_START (Marker
, Format
);
134 Return
= InternalPrint( Format
, gST
->StdErr
, Marker
);
143 Internal function which prints a formatted ASCII string to the console output device
146 This function prints a formatted ASCII string to the console output device
147 specified by Console and returns the number of ASCII characters that printed
148 to it. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize,
149 then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
151 @param Format Null-terminated ASCII format string.
152 @param Console The output console.
153 @param Marker VA_LIST marker for the variable argument list.
155 If Format is NULL, then ASSERT().
162 IN CONST CHAR8
*Format
,
163 IN EFI_SIMPLE_TEXT_OUT_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 ... VARARG list consumed to process Format.
204 If Format is NULL, then ASSERT().
205 If Format is not aligned on a 16-bit boundary, then ASSERT().
211 IN CONST CHAR8
*Format
,
218 VA_START (Marker
, Format
);
220 Return
= AsciiInternalPrint( Format
, gST
->ConOut
, Marker
);
228 Prints a formatted ASCII string to the console output device specified by
229 StdErr defined in the EFI_SYSTEM_TABLE.
231 This function prints a formatted ASCII string to the console output device
232 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
233 characters that printed to StdErr. If the length of the formatted ASCII
234 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
235 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
237 @param Format Null-terminated ASCII format string.
238 @param ... VARARG list consumed to process Format.
239 If Format is NULL, then ASSERT().
240 If Format is not aligned on a 16-bit boundary, then ASSERT().
246 IN CONST CHAR8
*Format
,
253 VA_START (Marker
, Format
);
255 Return
= AsciiInternalPrint( Format
, gST
->StdErr
, Marker
);