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 "FrameworkUefiLib.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().
38 IN CONST CHAR16
*Format
,
39 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Console
,
47 ASSERT (Format
!= NULL
);
48 ASSERT (((UINTN
) Format
& 0x01) == 0);
50 BufferSize
= (PcdGet32 (PcdUefiLibMaxPrintBufferSize
) + 1) * sizeof (CHAR16
);
52 Buffer
= (CHAR16
*) AllocatePool(BufferSize
);
53 ASSERT (Buffer
!= NULL
);
55 Return
= UnicodeVSPrint (Buffer
, BufferSize
, Format
, Marker
);
57 if (Console
!= NULL
) {
59 // To be extra safe make sure Console has been initialized
61 Console
->OutputString (Console
, Buffer
);
70 Prints a formatted Unicode string to the console output device specified by
71 ConOut defined in the EFI_SYSTEM_TABLE.
73 This function prints a formatted Unicode string to the console output device
74 specified by ConOut in EFI_SYSTEM_TABLE and returns the number of Unicode
75 characters that printed to ConOut. If the length of the formatted Unicode
76 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
77 PcdUefiLibMaxPrintBufferSize characters are sent to ConOut.
79 @param Format Null-terminated Unicode format string.
80 @param ... VARARG list consumed to process Format.
81 If Format is NULL, then ASSERT().
82 If Format is not aligned on a 16-bit boundary, then ASSERT().
88 IN CONST CHAR16
*Format
,
95 VA_START (Marker
, Format
);
97 Return
= InternalPrint (Format
, gST
->ConOut
, Marker
);
105 Prints a formatted Unicode string to the console output device specified by
106 StdErr defined in the EFI_SYSTEM_TABLE.
108 This function prints a formatted Unicode string to the console output device
109 specified by StdErr in EFI_SYSTEM_TABLE and returns the number of Unicode
110 characters that printed to StdErr. If the length of the formatted Unicode
111 string is greater than PcdUefiLibMaxPrintBufferSize, then only the first
112 PcdUefiLibMaxPrintBufferSize characters are sent to StdErr.
114 @param Format Null-terminated Unicode format string.
115 @param ... VARARG list consumed to process Format.
116 If Format is NULL, then ASSERT().
117 If Format is not aligned on a 16-bit boundary, then ASSERT().
124 IN CONST CHAR16
*Format
,
131 VA_START (Marker
, Format
);
133 Return
= InternalPrint( Format
, gST
->StdErr
, Marker
);
142 Internal function which prints a formatted ASCII string to the console output device
145 This function prints a formatted ASCII string to the console output device
146 specified by Console and returns the number of ASCII characters that printed
147 to it. If the length of the formatted ASCII string is greater than PcdUefiLibMaxPrintBufferSize,
148 then only the first PcdUefiLibMaxPrintBufferSize characters are sent to Console.
150 @param Format Null-terminated ASCII format string.
151 @param Console The output console.
152 @param Marker VA_LIST marker for the variable argument list.
154 If Format is NULL, then ASSERT().
160 IN CONST CHAR8
*Format
,
161 IN EFI_SIMPLE_TEXT_OUTPUT_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
);