3 This print protocol defines six basic print functions to
4 print the format unicode and ascii string.
6 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials are licensed and made available under
8 the terms and conditions of the BSD License that accompanies this distribution.
9 The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php.
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #define EFI_PRINT2_PROTOCOL_GUID \
21 { 0xf05976ef, 0x83f1, 0x4f3d, { 0x86, 0x19, 0xf7, 0x59, 0x5d, 0x41, 0xe5, 0x38 } }
24 // Forward reference for pure ANSI compatability
26 typedef struct _EFI_PRINT2_PROTOCOL EFI_PRINT2_PROTOCOL
;
29 Produces a Null-terminated Unicode string in an output buffer, based on
30 a Null-terminated Unicode format string and a BASE_LIST argument list
32 Produces a Null-terminated Unicode string in the output buffer
33 specified by StartOfBuffer and BufferSize.
34 The Unicode string is produced by parsing the format string specified by FormatString.
35 Arguments are pulled from the variable argument list specified by Marker.
36 Marker is constructed based on the contents of the format string.
37 This function returns the number of Unicode characters in the produced output buffer,
38 not including the Null-terminator.
39 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
41 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
42 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
43 If BufferSize > 1 and FormatString is NULL, then ASSERT().
44 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
45 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
46 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT().
47 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
48 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
49 Null-terminator, then ASSERT().
51 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
53 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
54 @param FormatString Null-terminated Unicode format string.
55 @param Marker BASE_LIST marker for the variable argument list.
57 @return The number of Unicode characters in the produced output buffer, not including the
63 (EFIAPI
*UNICODE_BS_PRINT
)(
64 OUT CHAR16
*StartOfBuffer
,
66 IN CONST CHAR16
*FormatString
,
71 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
72 Unicode format string and variable argument list.
74 Produces a Null-terminated Unicode string in the output buffer
75 specified by StartOfBuffer and BufferSize.
76 The Unicode string is produced by parsing the format string specified by FormatString.
77 Arguments are pulled from the variable argument list based on the contents of the format string.
78 This function returns the number of Unicode characters in the produced output buffer,
79 not including the Null-terminator.
80 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
82 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
83 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
84 If BufferSize > 1 and FormatString is NULL, then ASSERT().
85 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
86 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
87 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT().
88 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
89 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
90 Null-terminator, then ASSERT().
92 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
94 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
95 @param FormatString Null-terminated Unicode format string.
96 @param ... Variable argument list whose contents are accessed based on the
97 format string specified by FormatString.
99 @return The number of Unicode characters in the produced output buffer not including the
105 (EFIAPI
*UNICODE_S_PRINT
)(
106 OUT CHAR16
*StartOfBuffer
,
108 IN CONST CHAR16
*FormatString
,
113 Produces a Null-terminated Unicode string in an output buffer, based on a Null-terminated
114 ASCII format string and a BASE_LIST argument list
116 Produces a Null-terminated Unicode string in the output buffer
117 specified by StartOfBuffer and BufferSize.
118 The Unicode string is produced by parsing the format string specified by FormatString.
119 Arguments are pulled from the variable argument list specified by Marker based on the
120 contents of the format string.
121 This function returns the number of Unicode characters in the produced output buffer,
122 not including the Null-terminator.
123 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
125 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
126 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
127 If BufferSize > 1 and FormatString is NULL, then ASSERT().
128 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
129 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT().
130 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
131 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
132 Null-terminator, then ASSERT().
134 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
136 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
137 @param FormatString Null-terminated ASCII format string.
138 @param Marker BASE_LIST marker for the variable argument list.
140 @return The number of Unicode characters in the produced output buffer not including the
146 (EFIAPI
*UNICODE_BS_PRINT_ASCII_FORMAT
)(
147 OUT CHAR16
*StartOfBuffer
,
149 IN CONST CHAR8
*FormatString
,
154 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
155 ASCII format string and a variable argument list.
157 Produces a Null-terminated Unicode string in the output buffer
158 specified by StartOfBuffer and BufferSize.
159 The Unicode string is produced by parsing the format string specified by FormatString.
160 Arguments are pulled from the variable argument list based on the contents of the format string.
161 This function returns the number of Unicode characters in the produced output buffer,
162 not including the Null-terminator.
163 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
165 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
166 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
167 If BufferSize > 1 and FormatString is NULL, then ASSERT().
168 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
169 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT().
170 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
171 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
172 Null-terminator, then ASSERT().
174 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
176 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
177 @param FormatString Null-terminated ASCII format string.
178 @param ... Variable argument list whose contents are accessed based on the
179 format string specified by FormatString.
181 @return The number of Unicode characters in the produced output buffer not including the
187 (EFIAPI
*UNICODE_S_PRINT_ASCII_FORMAT
)(
188 OUT CHAR16
*StartOfBuffer
,
190 IN CONST CHAR8
*FormatString
,
195 Converts a decimal value to a Null-terminated Unicode string.
197 Converts the decimal number specified by Value to a Null-terminated Unicode
198 string specified by Buffer containing at most Width characters. No padding of spaces
199 is ever performed. If Width is 0, then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
200 This function returns the number of Unicode characters in Buffer, not including
202 If the conversion contains more than Width characters, this function returns
203 the first Width characters in the conversion, along with the total number of characters in the conversion.
204 Additional conversion parameters are specified in Flags.
206 The Flags bit LEFT_JUSTIFY is always ignored.
207 All conversions are left justified in Buffer.
208 If Width is 0, PREFIX_ZERO is ignored in Flags.
209 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
210 are inserted every 3rd digit starting from the right.
211 If RADIX_HEX is set in Flags, then the output buffer will be
212 formatted in hexadecimal format.
213 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
214 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
215 then Buffer is padded with '0' characters so the combination of the optional '-'
216 sign character, '0' characters, digit characters for Value, and the Null-terminator
217 add up to Width characters.
218 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
219 If Buffer is NULL, then ASSERT().
220 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
221 If unsupported bits are set in Flags, then ASSERT().
222 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
223 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
225 @param Buffer The pointer to the output buffer for the produced Null-terminated
227 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
228 @param Value The 64-bit signed value to convert to a string.
229 @param Width The maximum number of Unicode characters to place in Buffer, not including
232 @return The number of Unicode characters in Buffer not including the Null-terminator.
237 (EFIAPI
*UNICODE_VALUE_TO_STRING
)(
238 IN OUT CHAR16
*Buffer
,
245 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
246 ASCII format string and a BASE_LIST argument list.
248 Produces a Null-terminated ASCII string in the output buffer
249 pecified by StartOfBuffer and BufferSize.
250 The ASCII string is produced by parsing the format string specified by FormatString.
251 Arguments are pulled from the variable argument list specified by Marker based on
252 the contents of the format string.
253 This function returns the number of ASCII characters in the output buffer,
254 not including the Null-terminator.
255 If BufferSize is 0, then no output buffer is produced and 0 is returned.
257 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
258 If BufferSize > 0 and FormatString is NULL, then ASSERT().
259 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
260 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT().
261 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
262 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
263 Null-terminator, then ASSERT().
265 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
267 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
268 @param FormatString Null-terminated ASCII format string.
269 @param Marker BASE_LIST marker for the variable argument list.
271 @return The number of ASCII characters in the produced output buffer not including the
277 (EFIAPI
*ASCII_BS_PRINT
)(
278 OUT CHAR8
*StartOfBuffer
,
280 IN CONST CHAR8
*FormatString
,
285 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
286 ASCII format string and variable argument list.
288 Produces a Null-terminated ASCII string in the output buffer
289 specified by StartOfBuffer and BufferSize.
290 The ASCII string is produced by parsing the format string specified by FormatString.
291 Arguments are pulled from the variable argument list based on the contents of the format string.
292 This function returns the number of ASCII characters in the output buffer,
293 not including the Null-terminator.
294 If BufferSize is 0, then no output buffer is produced and 0 is returned.
296 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
297 If BufferSize > 0 and FormatString is NULL, then ASSERT().
298 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
299 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then ASSERT().
300 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
301 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
302 Null-terminator, then ASSERT().
304 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
306 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
307 @param FormatString Null-terminated ASCII format string.
308 @param ... Variable argument list whose contents are accessed based on the
309 format string specified by FormatString.
311 @return The number of ASCII characters in the produced output buffer not including the
317 (EFIAPI
*ASCII_S_PRINT
)(
318 OUT CHAR8
*StartOfBuffer
,
320 IN CONST CHAR8
*FormatString
,
325 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
326 Unicode format string and a BASE_LIST argument list.
328 Produces a Null-terminated ASCII string in the output buffer
329 specified by StartOfBuffer and BufferSize.
330 The ASCII string is produced by parsing the format string specified by FormatString.
331 Arguments are pulled from the variable argument list specified by Marker based on
332 the contents of the format string.
333 This function returns the number of ASCII characters in the output buffer,
334 not including the Null-terminator.
335 If BufferSize is 0, then no output buffer is produced and 0 is returned.
337 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
338 If BufferSize > 0 and FormatString is NULL, then ASSERT().
339 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
340 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
341 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT().
342 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
343 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
344 Null-terminator, then ASSERT().
346 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
348 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
349 @param FormatString Null-terminated Unicode format string.
350 @param Marker BASE_LIST marker for the variable argument list.
352 @return The number of ASCII characters in the produced output buffer not including the
358 (EFIAPI
*ASCII_BS_PRINT_UNICODE_FORMAT
)(
359 OUT CHAR8
*StartOfBuffer
,
361 IN CONST CHAR16
*FormatString
,
366 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
367 Unicode format string and variable argument list.
369 Produces a Null-terminated ASCII string in the output buffer
370 specified by StartOfBuffer and BufferSize.
371 The ASCII string is produced by parsing the format string specified by FormatString.
372 Arguments are pulled from the variable argument list based on the contents of the format string.
373 This function returns the number of ASCII characters in the output buffer,
374 not including the Null-terminator.
375 If BufferSize is 0, then no output buffer is produced and 0 is returned.
377 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
378 If BufferSize > 0 and FormatString is NULL, then ASSERT().
379 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
380 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
381 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then ASSERT().
382 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
383 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
384 Null-terminator, then ASSERT().
386 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
388 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
389 @param FormatString Null-terminated Unicode format string.
390 @param ... Variable argument list whose contents are accessed based on the
391 format string specified by FormatString.
393 @return The number of ASCII characters in the produced output buffer not including the
399 (EFIAPI
*ASCII_S_PRINT_UNICODE_FORMAT
)(
400 OUT CHAR8
*StartOfBuffer
,
402 IN CONST CHAR16
*FormatString
,
407 Converts a decimal value to a Null-terminated ASCII string.
409 Converts the decimal number specified by Value to a Null-terminated ASCII string
410 specified by Buffer containing at most Width characters. No padding of spaces is ever performed.
411 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
412 The number of ASCII characters in Buffer is returned not including the Null-terminator.
413 If the conversion contains more than Width characters, then only the first Width
414 characters are returned, and the total number of characters required to perform
415 the conversion is returned.
416 Additional conversion parameters are specified in Flags.
417 The Flags bit LEFT_JUSTIFY is always ignored.
418 All conversions are left justified in Buffer.
419 If Width is 0, PREFIX_ZERO is ignored in Flags.
420 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
421 are inserted every 3rd digit starting from the right.
422 If RADIX_HEX is set in Flags, then the output buffer will be
423 formatted in hexadecimal format.
424 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
425 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
426 then Buffer is padded with '0' characters so the combination of the optional '-'
427 sign character, '0' characters, digit characters for Value, and the Null-terminator
428 add up to Width characters.
430 If Buffer is NULL, then ASSERT().
431 If unsupported bits are set in Flags, then ASSERT().
432 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
433 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
435 @param Buffer The pointer to the output buffer for the produced Null-terminated
437 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
438 @param Value The 64-bit signed value to convert to a string.
439 @param Width The maximum number of ASCII characters to place in Buffer, not including
442 @return The number of ASCII characters in Buffer not including the Null-terminator.
447 (EFIAPI
*ASCII_VALUE_TO_STRING
)(
454 struct _EFI_PRINT2_PROTOCOL
{
455 UNICODE_BS_PRINT UnicodeBSPrint
;
456 UNICODE_S_PRINT UnicodeSPrint
;
457 UNICODE_BS_PRINT_ASCII_FORMAT UnicodeBSPrintAsciiFormat
;
458 UNICODE_S_PRINT_ASCII_FORMAT UnicodeSPrintAsciiFormat
;
459 UNICODE_VALUE_TO_STRING UnicodeValueToString
;
460 ASCII_BS_PRINT AsciiBSPrint
;
461 ASCII_S_PRINT AsciiSPrint
;
462 ASCII_BS_PRINT_UNICODE_FORMAT AsciiBSPrintUnicodeFormat
;
463 ASCII_S_PRINT_UNICODE_FORMAT AsciiSPrintUnicodeFormat
;
464 ASCII_VALUE_TO_STRING AsciiValueToString
;
467 extern EFI_GUID gEfiPrint2ProtocolGuid
;