]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/Protocol/Print2.h
MdeModulePkg: Refine the services comments in EFI_PRINT2_PROTOCOL
[mirror_edk2.git] / MdeModulePkg / Include / Protocol / Print2.h
1 /** @file
2
3 This print protocol defines six basic print functions to
4 print the format unicode and ascii string.
5
6 Copyright (c) 2006 - 2017, 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.
11
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.
14
15 **/
16
17 #ifndef __PPRINT2_H__
18 #define __PPRINT2_H__
19
20 #define EFI_PRINT2_PROTOCOL_GUID \
21 { 0xf05976ef, 0x83f1, 0x4f3d, { 0x86, 0x19, 0xf7, 0x59, 0x5d, 0x41, 0xe5, 0x38 } }
22
23 //
24 // Forward reference for pure ANSI compatability
25 //
26 typedef struct _EFI_PRINT2_PROTOCOL EFI_PRINT2_PROTOCOL;
27
28 /**
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.
31
32 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
33 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 based on the
36 contents of the format string.
37 The number of Unicode characters in the produced output buffer is returned not including
38 the Null-terminator.
39
40 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
41 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
42
43 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
44 unmodified and 0 is returned.
45 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
46 unmodified and 0 is returned.
47 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
48 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
49 buffer is unmodified and 0 is returned.
50 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
51 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
52 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
53
54 If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
55
56 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
57 Unicode string.
58 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
59 @param FormatString A Null-terminated Unicode format string.
60 @param Marker BASE_LIST marker for the variable argument list.
61
62 @return The number of Unicode characters in the produced output buffer not including the
63 Null-terminator.
64
65 **/
66 typedef
67 UINTN
68 (EFIAPI *UNICODE_BS_PRINT)(
69 OUT CHAR16 *StartOfBuffer,
70 IN UINTN BufferSize,
71 IN CONST CHAR16 *FormatString,
72 IN BASE_LIST Marker
73 );
74
75 /**
76 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
77 Unicode format string and variable argument list.
78
79 This function is similar as snprintf_s defined in C11.
80
81 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
82 and BufferSize.
83 The Unicode string is produced by parsing the format string specified by FormatString.
84 Arguments are pulled from the variable argument list based on the contents of the format string.
85 The number of Unicode characters in the produced output buffer is returned not including
86 the Null-terminator.
87
88 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
89 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
90
91 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
92 unmodified and 0 is returned.
93 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
94 unmodified and 0 is returned.
95 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
96 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
97 buffer is unmodified and 0 is returned.
98 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
99 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
100 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
101
102 If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.
103
104 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
105 Unicode string.
106 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
107 @param FormatString A Null-terminated Unicode format string.
108 @param ... Variable argument list whose contents are accessed based on the
109 format string specified by FormatString.
110
111 @return The number of Unicode characters in the produced output buffer not including the
112 Null-terminator.
113
114 **/
115 typedef
116 UINTN
117 (EFIAPI *UNICODE_S_PRINT)(
118 OUT CHAR16 *StartOfBuffer,
119 IN UINTN BufferSize,
120 IN CONST CHAR16 *FormatString,
121 ...
122 );
123
124 /**
125 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
126 ASCII format string and a BASE_LIST argument list.
127
128 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
129 and BufferSize.
130 The Unicode string is produced by parsing the format string specified by FormatString.
131 Arguments are pulled from the variable argument list specified by Marker based on the
132 contents of the format string.
133 The number of Unicode characters in the produced output buffer is returned not including
134 the Null-terminator.
135
136 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
137
138 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
139 unmodified and 0 is returned.
140 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
141 unmodified and 0 is returned.
142 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
143 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
144 buffer is unmodified and 0 is returned.
145 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
146 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
147 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
148
149 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
150
151 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
152 Unicode string.
153 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
154 @param FormatString A Null-terminated ASCII format string.
155 @param Marker BASE_LIST marker for the variable argument list.
156
157 @return The number of Unicode characters in the produced output buffer not including the
158 Null-terminator.
159
160 **/
161 typedef
162 UINTN
163 (EFIAPI *UNICODE_BS_PRINT_ASCII_FORMAT)(
164 OUT CHAR16 *StartOfBuffer,
165 IN UINTN BufferSize,
166 IN CONST CHAR8 *FormatString,
167 IN BASE_LIST Marker
168 );
169
170 /**
171 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
172 ASCII format string and variable argument list.
173
174 This function is similar as snprintf_s defined in C11.
175
176 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
177 and BufferSize.
178 The Unicode string is produced by parsing the format string specified by FormatString.
179 Arguments are pulled from the variable argument list based on the contents of the
180 format string.
181 The number of Unicode characters in the produced output buffer is returned not including
182 the Null-terminator.
183
184 If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
185
186 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
187 unmodified and 0 is returned.
188 If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is
189 unmodified and 0 is returned.
190 If PcdMaximumUnicodeStringLength is not zero, and BufferSize >
191 (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output
192 buffer is unmodified and 0 is returned.
193 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
194 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
195 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
196
197 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
198
199 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
200 Unicode string.
201 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
202 @param FormatString A Null-terminated ASCII format string.
203 @param ... Variable argument list whose contents are accessed based on the
204 format string specified by FormatString.
205
206 @return The number of Unicode characters in the produced output buffer not including the
207 Null-terminator.
208
209 **/
210 typedef
211 UINTN
212 (EFIAPI *UNICODE_S_PRINT_ASCII_FORMAT)(
213 OUT CHAR16 *StartOfBuffer,
214 IN UINTN BufferSize,
215 IN CONST CHAR8 *FormatString,
216 ...
217 );
218
219 /**
220 Converts a decimal value to a Null-terminated Unicode string.
221
222 Converts the decimal number specified by Value to a Null-terminated Unicode
223 string specified by Buffer containing at most Width characters. No padding of spaces
224 is ever performed. If Width is 0, then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
225 This function returns the number of Unicode characters in Buffer, not including
226 the Null-terminator.
227 If the conversion contains more than Width characters, this function returns
228 the first Width characters in the conversion, along with the total number of characters in the conversion.
229 Additional conversion parameters are specified in Flags.
230
231 The Flags bit LEFT_JUSTIFY is always ignored.
232 All conversions are left justified in Buffer.
233 If Width is 0, PREFIX_ZERO is ignored in Flags.
234 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
235 are inserted every 3rd digit starting from the right.
236 If RADIX_HEX is set in Flags, then the output buffer will be
237 formatted in hexadecimal format.
238 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
239 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
240 then Buffer is padded with '0' characters so the combination of the optional '-'
241 sign character, '0' characters, digit characters for Value, and the Null-terminator
242 add up to Width characters.
243 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
244 If Buffer is NULL, then ASSERT().
245 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
246 If unsupported bits are set in Flags, then ASSERT().
247 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
248 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
249
250 @param Buffer The pointer to the output buffer for the produced Null-terminated
251 Unicode string.
252 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
253 @param Value The 64-bit signed value to convert to a string.
254 @param Width The maximum number of Unicode characters to place in Buffer, not including
255 the Null-terminator.
256
257 @return The number of Unicode characters in Buffer not including the Null-terminator.
258
259 **/
260 typedef
261 UINTN
262 (EFIAPI *UNICODE_VALUE_TO_STRING)(
263 IN OUT CHAR16 *Buffer,
264 IN UINTN Flags,
265 IN INT64 Value,
266 IN UINTN Width
267 );
268
269 /**
270 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
271 ASCII format string and a BASE_LIST argument list.
272
273 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
274 and BufferSize.
275 The ASCII string is produced by parsing the format string specified by FormatString.
276 Arguments are pulled from the variable argument list specified by Marker based on
277 the contents of the format string.
278 The number of ASCII characters in the produced output buffer is returned not including
279 the Null-terminator.
280
281 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
282 unmodified and 0 is returned.
283 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
284 unmodified and 0 is returned.
285 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
286 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
287 is unmodified and 0 is returned.
288 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
289 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
290 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
291
292 If BufferSize is 0, then no output buffer is produced and 0 is returned.
293
294 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
295 ASCII string.
296 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
297 @param FormatString A Null-terminated ASCII format string.
298 @param Marker BASE_LIST marker for the variable argument list.
299
300 @return The number of ASCII characters in the produced output buffer not including the
301 Null-terminator.
302
303 **/
304 typedef
305 UINTN
306 (EFIAPI *ASCII_BS_PRINT)(
307 OUT CHAR8 *StartOfBuffer,
308 IN UINTN BufferSize,
309 IN CONST CHAR8 *FormatString,
310 IN BASE_LIST Marker
311 );
312
313 /**
314 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
315 ASCII format string and variable argument list.
316
317 This function is similar as snprintf_s defined in C11.
318
319 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
320 and BufferSize.
321 The ASCII string is produced by parsing the format string specified by FormatString.
322 Arguments are pulled from the variable argument list based on the contents of the
323 format string.
324 The number of ASCII characters in the produced output buffer is returned not including
325 the Null-terminator.
326
327 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
328 unmodified and 0 is returned.
329 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
330 unmodified and 0 is returned.
331 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
332 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
333 is unmodified and 0 is returned.
334 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
335 PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then
336 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
337
338 If BufferSize is 0, then no output buffer is produced and 0 is returned.
339
340 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
341 ASCII string.
342 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
343 @param FormatString A Null-terminated ASCII format string.
344 @param ... Variable argument list whose contents are accessed based on the
345 format string specified by FormatString.
346
347 @return The number of ASCII characters in the produced output buffer not including the
348 Null-terminator.
349
350 **/
351 typedef
352 UINTN
353 (EFIAPI *ASCII_S_PRINT)(
354 OUT CHAR8 *StartOfBuffer,
355 IN UINTN BufferSize,
356 IN CONST CHAR8 *FormatString,
357 ...
358 );
359
360 /**
361 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
362 Unicode format string and a BASE_LIST argument list.
363
364 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
365 and BufferSize.
366 The ASCII string is produced by parsing the format string specified by FormatString.
367 Arguments are pulled from the variable argument list specified by Marker based on
368 the contents of the format string.
369 The number of ASCII characters in the produced output buffer is returned not including
370 the Null-terminator.
371
372 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
373
374 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
375 unmodified and 0 is returned.
376 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
377 unmodified and 0 is returned.
378 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
379 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
380 is unmodified and 0 is returned.
381 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
382 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
383 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
384
385 If BufferSize is 0, then no output buffer is produced and 0 is returned.
386
387 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
388 ASCII string.
389 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
390 @param FormatString A Null-terminated Unicode format string.
391 @param Marker BASE_LIST marker for the variable argument list.
392
393 @return The number of ASCII characters in the produced output buffer not including the
394 Null-terminator.
395
396 **/
397 typedef
398 UINTN
399 (EFIAPI *ASCII_BS_PRINT_UNICODE_FORMAT)(
400 OUT CHAR8 *StartOfBuffer,
401 IN UINTN BufferSize,
402 IN CONST CHAR16 *FormatString,
403 IN BASE_LIST Marker
404 );
405
406 /**
407 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
408 Unicode format string and variable argument list.
409
410 This function is similar as snprintf_s defined in C11.
411
412 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
413 and BufferSize.
414 The ASCII string is produced by parsing the format string specified by FormatString.
415 Arguments are pulled from the variable argument list based on the contents of the
416 format string.
417 The number of ASCII characters in the produced output buffer is returned not including
418 the Null-terminator.
419
420 If FormatString is not aligned on a 16-bit boundary, then ASSERT().
421
422 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is
423 unmodified and 0 is returned.
424 If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is
425 unmodified and 0 is returned.
426 If PcdMaximumAsciiStringLength is not zero, and BufferSize >
427 (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer
428 is unmodified and 0 is returned.
429 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
430 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
431 ASSERT(). Also, the output buffer is unmodified and 0 is returned.
432
433 If BufferSize is 0, then no output buffer is produced and 0 is returned.
434
435 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
436 ASCII string.
437 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
438 @param FormatString A Null-terminated Unicode format string.
439 @param ... Variable argument list whose contents are accessed based on the
440 format string specified by FormatString.
441
442 @return The number of ASCII characters in the produced output buffer not including the
443 Null-terminator.
444
445 **/
446 typedef
447 UINTN
448 (EFIAPI *ASCII_S_PRINT_UNICODE_FORMAT)(
449 OUT CHAR8 *StartOfBuffer,
450 IN UINTN BufferSize,
451 IN CONST CHAR16 *FormatString,
452 ...
453 );
454
455 /**
456 Converts a decimal value to a Null-terminated ASCII string.
457
458 Converts the decimal number specified by Value to a Null-terminated ASCII string
459 specified by Buffer containing at most Width characters. No padding of spaces is ever performed.
460 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
461 The number of ASCII characters in Buffer is returned not including the Null-terminator.
462 If the conversion contains more than Width characters, then only the first Width
463 characters are returned, and the total number of characters required to perform
464 the conversion is returned.
465 Additional conversion parameters are specified in Flags.
466 The Flags bit LEFT_JUSTIFY is always ignored.
467 All conversions are left justified in Buffer.
468 If Width is 0, PREFIX_ZERO is ignored in Flags.
469 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
470 are inserted every 3rd digit starting from the right.
471 If RADIX_HEX is set in Flags, then the output buffer will be
472 formatted in hexadecimal format.
473 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
474 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
475 then Buffer is padded with '0' characters so the combination of the optional '-'
476 sign character, '0' characters, digit characters for Value, and the Null-terminator
477 add up to Width characters.
478
479 If Buffer is NULL, then ASSERT().
480 If unsupported bits are set in Flags, then ASSERT().
481 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
482 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
483
484 @param Buffer The pointer to the output buffer for the produced Null-terminated
485 ASCII string.
486 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
487 @param Value The 64-bit signed value to convert to a string.
488 @param Width The maximum number of ASCII characters to place in Buffer, not including
489 the Null-terminator.
490
491 @return The number of ASCII characters in Buffer not including the Null-terminator.
492
493 **/
494 typedef
495 UINTN
496 (EFIAPI *ASCII_VALUE_TO_STRING)(
497 OUT CHAR8 *Buffer,
498 IN UINTN Flags,
499 IN INT64 Value,
500 IN UINTN Width
501 );
502
503 struct _EFI_PRINT2_PROTOCOL {
504 UNICODE_BS_PRINT UnicodeBSPrint;
505 UNICODE_S_PRINT UnicodeSPrint;
506 UNICODE_BS_PRINT_ASCII_FORMAT UnicodeBSPrintAsciiFormat;
507 UNICODE_S_PRINT_ASCII_FORMAT UnicodeSPrintAsciiFormat;
508 UNICODE_VALUE_TO_STRING UnicodeValueToString;
509 ASCII_BS_PRINT AsciiBSPrint;
510 ASCII_S_PRINT AsciiSPrint;
511 ASCII_BS_PRINT_UNICODE_FORMAT AsciiBSPrintUnicodeFormat;
512 ASCII_S_PRINT_UNICODE_FORMAT AsciiSPrintUnicodeFormat;
513 ASCII_VALUE_TO_STRING AsciiValueToString;
514 };
515
516 extern EFI_GUID gEfiPrint2ProtocolGuid;
517
518 #endif