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