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 common header file for this module.
19 #include "UefiLibInternal.h"
22 Internal function which prints a formatted Unicode string to the console output device
25 This function prints a formatted Unicode string to the console output device
26 specified by Console and returns the number of Unicode characters that printed
27 to it. If the length of the formatted Unicode string is greater than PcdUefiLibMaxPrintBufferSize,
28 then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
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 If Format is NULL, then ASSERT().
35 If Format is not aligned on a 16-bit boundary, then ASSERT().
42 IN CONST CHAR16
*Format
,
43 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Console
,
51 ASSERT (Format
!= NULL
);
52 ASSERT (((UINTN
) Format
& 0x01) == 0);
54 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
56 Buffer
= (CHAR16
*) AllocatePool(BufferSize
);
57 ASSERT (Buffer
!= NULL
);
59 Return
= UnicodeVSPrint (Buffer
, BufferSize
, Format
, Marker
);
61 if (Console
!= NULL
) {
63 // To be extra safe make sure Console has been initialized
65 Console
->OutputString (Console
, Buffer
);
74 Prints a formatted Unicode string to the console output device specified by
75 ConOut defined in the EFI_SYSTEM_TABLE.
77 This function prints a formatted Unicode string to the console output device
78 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
79 characters that printed to ConOut. If the length of the formatted Unicode
80 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
81 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
83 @param Format Null-terminated Unicode format string.
84 @param ... VARARG list consumed to process Format.
85 If Format is NULL, then ASSERT().
86 If Format is not aligned on a 16-bit boundary, then ASSERT().
92 IN CONST CHAR16
*Format
,
99 VA_START (Marker
, Format
);
101 Return
= InternalPrint (Format
, gST
->ConOut
, Marker
);
109 Prints a formatted Unicode string to the console output device specified by
110 StdErr defined in the EFI_SYSTEM_TABLE.
112 This function prints a formatted Unicode string to the console output device
113 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
114 characters that printed to StdErr. If the length of the formatted Unicode
115 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
116 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
118 @param Format Null-terminated Unicode format string.
119 @param ... VARARG list consumed to process Format.
120 If Format is NULL, then ASSERT().
121 If Format is not aligned on a 16-bit boundary, then ASSERT().
128 IN CONST CHAR16
*Format
,
135 VA_START (Marker
, Format
);
137 Return
= InternalPrint( Format
, gST
->StdErr
, Marker
);
146 Internal function which prints a formatted ASCII string to the console output device
149 This function prints a formatted ASCII string to the console output device
150 specified by Console and returns the number of ASCII characters that printed
151 to it. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize,
152 then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
154 @param Format Null-terminated ASCII format string.
155 @param Console The output console.
156 @param Marker VA_LIST marker for the variable argument list.
158 If Format is NULL, then ASSERT().
165 IN CONST CHAR8
*Format
,
166 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Console
,
174 ASSERT (Format
!= NULL
);
176 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
178 Buffer
= (CHAR16
*) AllocatePool(BufferSize
);
179 ASSERT (Buffer
!= NULL
);
181 Return
= UnicodeVSPrintAsciiFormat (Buffer
, BufferSize
, Format
, Marker
);
183 if (Console
!= NULL
) {
185 // To be extra safe make sure Console has been initialized
187 Console
->OutputString (Console
, Buffer
);
196 Prints a formatted ASCII string to the console output device specified by
197 ConOut defined in the EFI_SYSTEM_TABLE.
199 This function prints a formatted ASCII string to the console output device
200 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of ASCII
201 characters that printed to ConOut. If the length of the formatted ASCII
202 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
203 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
205 @param Format Null-terminated ASCII format string.
206 @param ... VARARG list consumed to process Format.
207 If Format is NULL, then ASSERT().
208 If Format is not aligned on a 16-bit boundary, then ASSERT().
214 IN CONST CHAR8
*Format
,
221 VA_START (Marker
, Format
);
223 Return
= AsciiInternalPrint( Format
, gST
->ConOut
, Marker
);
231 Prints a formatted ASCII string to the console output device specified by
232 StdErr defined in the EFI_SYSTEM_TABLE.
234 This function prints a formatted ASCII string to the console output device
235 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of ASCII
236 characters that printed to StdErr. If the length of the formatted ASCII
237 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
238 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
240 @param Format Null-terminated ASCII format string.
241 @param ... VARARG list consumed to process Format.
242 If Format is NULL, then ASSERT().
243 If Format is not aligned on a 16-bit boundary, then ASSERT().
249 IN CONST CHAR8
*Format
,
256 VA_START (Marker
, Format
);
258 Return
= AsciiInternalPrint( Format
, gST
->StdErr
, Marker
);