]>
Commit | Line | Data |
---|---|---|
488ee641 | 1 | /** @file\r |
50a64e5b | 2 | Provides services to print a formatted string to a buffer. All combinations of\r |
3 | Unicode and ASCII strings are supported.\r | |
488ee641 | 4 | \r |
9095d37b | 5 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
488ee641 | 7 | \r |
9095d37b LG |
8 | The Print Library functions provide a simple means to produce formatted output\r |
9 | strings. Many of the output functions use a format string to describe how to\r | |
10 | format the output of variable arguments. The format string consists of normal\r | |
11 | text and argument descriptors. There are no restrictions for how the normal\r | |
12 | text and argument descriptors can be mixed. The following end of line(EOL)\r | |
c553db4b | 13 | translations must be performed on the contents of the format string:\r |
9095d37b | 14 | \r |
c553db4b | 15 | - '\\r' is translated to '\\r'\r |
16 | - '\\r\\n' is translated to '\\r\\n'\r | |
9095d37b | 17 | - '\\n' is translated to '\\r\\n'\r |
c553db4b | 18 | - '\\n\\r' is translated to '\\r\\n'\r |
9095d37b LG |
19 | \r |
20 | This does not follow the ANSI C standard for sprint(). The format of argument\r | |
21 | descriptors is described below. The ANSI C standard for sprint() has been\r | |
22 | followed for some of the format types, and has not been followed for others.\r | |
c553db4b | 23 | The exceptions are noted below.\r |
b7ca8783 | 24 | \r |
25 | %[flags][width][.precision]type\r | |
26 | \r | |
27 | [flags]:\r | |
9095d37b LG |
28 | - -\r |
29 | - The field is left justified. If not flag is not specified, then the\r | |
b7ca8783 | 30 | field is right justified.\r |
9095d37b | 31 | - space\r |
b7ca8783 | 32 | - Prefix a space character to a number. Only valid for types X, x, and d.\r |
9095d37b LG |
33 | - +\r |
34 | - Prefix a plus character to a number. Only valid for types X, x, and d.\r | |
b7ca8783 | 35 | If both space and + are specified, then space is ignored.\r |
36 | - 0\r | |
9095d37b | 37 | - Pad with 0 characters to the left of a number. Only valid for types\r |
b7ca8783 | 38 | X, x, and d.\r |
39 | - ,\r | |
40 | - Place a comma every 3rd digit of the number. Only valid for type d.\r | |
41 | If 0 is also specified, then 0 is ignored.\r | |
42 | - L, l\r | |
790f3b75 LG |
43 | - The number being printed is size UINT64. Only valid for types X, x, and d.\r |
44 | If this flag is not specified, then the number being printed is size int.\r | |
b7ca8783 | 45 | - NOTE: All invalid flags are ignored.\r |
46 | \r | |
47 | [width]:\r | |
48 | \r | |
49 | - *\r | |
9095d37b | 50 | - The width of the field is specified by a UINTN argument in the\r |
b7ca8783 | 51 | argument list.\r |
52 | - number\r | |
9095d37b | 53 | - The number specified as a decimal value represents the width of\r |
b7ca8783 | 54 | the field.\r |
55 | - NOTE: If [width] is not specified, then a field width of 0 is assumed.\r | |
56 | \r | |
57 | [.precision]:\r | |
58 | \r | |
59 | - *\r | |
9095d37b | 60 | - The precision of the field is specified by a UINTN argument in the\r |
b7ca8783 | 61 | argument list.\r |
62 | - number\r | |
9095d37b | 63 | - The number specified as a decimal value represents the precision of\r |
b7ca8783 | 64 | the field.\r |
65 | - NOTE: If [.precision] is not specified, then a precision of 0 is assumed.\r | |
66 | \r | |
67 | type:\r | |
68 | \r | |
69 | - %\r | |
70 | - Print a %%.\r | |
71 | - c\r | |
9095d37b | 72 | - The argument is a Unicode character. ASCII characters can be printed\r |
b7ca8783 | 73 | using this type too by making sure bits 8..15 of the argument are set to 0.\r |
74 | - x\r | |
9095d37b LG |
75 | - The argument is an unsigned hexadecimal number. The characters used are 0..9 and\r |
76 | A..F. If the flag 'L' is not specified, then the argument is assumed\r | |
790f3b75 | 77 | to be size int. This does not follow ANSI C.\r |
b7ca8783 | 78 | - X\r |
9095d37b LG |
79 | - The argument is an unsigned hexadecimal number and the number is padded with\r |
80 | zeros. This is equivalent to a format string of "0x". If the flag\r | |
81 | 'L' is not specified, then the argument is assumed to be size int.\r | |
b7ca8783 | 82 | This does not follow ANSI C.\r |
83 | - d\r | |
9095d37b LG |
84 | - The argument is a signed decimal number. If the flag 'L' is not specified,\r |
85 | then the argument is assumed to be size int.\r | |
9ade4339 | 86 | - u\r |
9095d37b | 87 | - The argument is a unsigned decimal number. If the flag 'L' is not specified,\r |
9ade4339 | 88 | then the argument is assumed to be size int.\r |
b7ca8783 | 89 | - p\r |
9095d37b | 90 | - The argument is a pointer that is a (VOID *), and it is printed as an\r |
790f3b75 | 91 | unsigned hexadecimal number The characters used are 0..9 and A..F.\r |
b7ca8783 | 92 | - a\r |
9095d37b | 93 | - The argument is a pointer to an ASCII string.\r |
b7ca8783 | 94 | This does not follow ANSI C.\r |
95 | - S, s\r | |
9095d37b | 96 | - The argument is a pointer to a Unicode string.\r |
b7ca8783 | 97 | This does not follow ANSI C.\r |
98 | - g\r | |
9095d37b LG |
99 | - The argument is a pointer to a GUID structure. The GUID is printed\r |
100 | in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.\r | |
b7ca8783 | 101 | This does not follow ANSI C.\r |
102 | - t\r | |
9095d37b LG |
103 | - The argument is a pointer to an EFI_TIME structure. The time and\r |
104 | date are printed in the format "mm/dd/yyyy hh:mm" where mm is the\r | |
105 | month zero padded, dd is the day zero padded, yyyy is the year zero\r | |
106 | padded, hh is the hour zero padded, and mm is minutes zero padded.\r | |
107 | This does not follow ANSI C.\r | |
b7ca8783 | 108 | - r\r |
9095d37b LG |
109 | - The argument is a RETURN_STATUS value. This value is converted to\r |
110 | a string following the table below. This does not follow ANSI C.\r | |
111 | - RETURN_SUCCESS\r | |
b7ca8783 | 112 | - "Success"\r |
9095d37b | 113 | - RETURN_LOAD_ERROR\r |
b7ca8783 | 114 | - "Load Error"\r |
9095d37b | 115 | - RETURN_INVALID_PARAMETER\r |
b7ca8783 | 116 | - "Invalid Parameter"\r |
9095d37b | 117 | - RETURN_UNSUPPORTED\r |
b7ca8783 | 118 | - "Unsupported"\r |
9095d37b | 119 | - RETURN_BAD_BUFFER_SIZE\r |
b7ca8783 | 120 | - "Bad Buffer Size"\r |
9095d37b | 121 | - RETURN_BUFFER_TOO_SMALL\r |
b7ca8783 | 122 | - "Buffer Too Small"\r |
9095d37b | 123 | - RETURN_NOT_READY\r |
b7ca8783 | 124 | - "Not Ready"\r |
9095d37b | 125 | - RETURN_DEVICE_ERROR\r |
b7ca8783 | 126 | - "Device Error"\r |
9095d37b | 127 | - RETURN_WRITE_PROTECTED\r |
b7ca8783 | 128 | - "Write Protected"\r |
9095d37b | 129 | - RETURN_OUT_OF_RESOURCES\r |
b7ca8783 | 130 | - "Out of Resources"\r |
9095d37b | 131 | - RETURN_VOLUME_CORRUPTED\r |
b7ca8783 | 132 | - "Volume Corrupt"\r |
9095d37b | 133 | - RETURN_VOLUME_FULL\r |
b7ca8783 | 134 | - "Volume Full"\r |
9095d37b | 135 | - RETURN_NO_MEDIA\r |
b7ca8783 | 136 | - "No Media"\r |
9095d37b | 137 | - RETURN_MEDIA_CHANGED\r |
b7ca8783 | 138 | - "Media changed"\r |
9095d37b | 139 | - RETURN_NOT_FOUND\r |
b7ca8783 | 140 | - "Not Found"\r |
9095d37b | 141 | - RETURN_ACCESS_DENIED\r |
b7ca8783 | 142 | - "Access Denied"\r |
9095d37b | 143 | - RETURN_NO_RESPONSE\r |
b7ca8783 | 144 | - "No Response"\r |
9095d37b | 145 | - RETURN_NO_MAPPING\r |
b7ca8783 | 146 | - "No mapping"\r |
9095d37b | 147 | - RETURN_TIMEOUT\r |
b7ca8783 | 148 | - "Time out"\r |
9095d37b | 149 | - RETURN_NOT_STARTED\r |
b7ca8783 | 150 | - "Not started"\r |
9095d37b | 151 | - RETURN_ALREADY_STARTED\r |
b7ca8783 | 152 | - "Already started"\r |
9095d37b | 153 | - RETURN_ABORTED\r |
b7ca8783 | 154 | - "Aborted"\r |
9095d37b | 155 | - RETURN_ICMP_ERROR\r |
b7ca8783 | 156 | - "ICMP Error"\r |
9095d37b | 157 | - RETURN_TFTP_ERROR\r |
b7ca8783 | 158 | - "TFTP Error"\r |
9095d37b | 159 | - RETURN_PROTOCOL_ERROR\r |
b7ca8783 | 160 | - "Protocol Error"\r |
9095d37b | 161 | - RETURN_WARN_UNKNOWN_GLYPH\r |
b7ca8783 | 162 | - "Warning Unknown Glyph"\r |
9095d37b | 163 | - RETURN_WARN_DELETE_FAILURE\r |
b7ca8783 | 164 | - "Warning Delete Failure"\r |
9095d37b | 165 | - RETURN_WARN_WRITE_FAILURE\r |
b7ca8783 | 166 | - "Warning Write Failure"\r |
9095d37b | 167 | - RETURN_WARN_BUFFER_TOO_SMALL\r |
b7ca8783 | 168 | - "Warning Buffer Too Small"\r |
169 | \r | |
488ee641 | 170 | **/\r |
171 | \r | |
172 | #ifndef __PRINT_LIB_H__\r | |
173 | #define __PRINT_LIB_H__\r | |
174 | \r | |
175 | ///\r | |
176 | /// Define the maximum number of characters that are required to\r | |
9095d37b | 177 | /// encode with a NULL terminator a decimal, hexadecimal, GUID,\r |
af2dc6a7 | 178 | /// or TIME value.\r |
9095d37b | 179 | ///\r |
488ee641 | 180 | /// Maximum Length Decimal String = 28\r |
181 | /// "-9,223,372,036,854,775,808"\r | |
a9b896f4 | 182 | /// Maximum Length Hexadecimal String = 17\r |
488ee641 | 183 | /// "FFFFFFFFFFFFFFFF"\r |
184 | /// Maximum Length GUID = 37\r | |
185 | /// "00000000-0000-0000-0000-000000000000"\r | |
186 | /// Maximum Length TIME = 18\r | |
187 | /// "12/12/2006 12:12"\r | |
188 | ///\r | |
189 | #define MAXIMUM_VALUE_CHARACTERS 38\r | |
190 | \r | |
191 | ///\r | |
9095d37b | 192 | /// Flags bitmask values use in UnicodeValueToString() and\r |
488ee641 | 193 | /// AsciiValueToString()\r |
194 | ///\r | |
2f88bd3a MK |
195 | #define LEFT_JUSTIFY 0x01\r |
196 | #define COMMA_TYPE 0x08\r | |
197 | #define PREFIX_ZERO 0x20\r | |
198 | #define RADIX_HEX 0x80\r | |
488ee641 | 199 | \r |
200 | /**\r | |
9b002aa4 | 201 | Produces a Null-terminated Unicode string in an output buffer based on\r |
af2dc6a7 | 202 | a Null-terminated Unicode format string and a VA_LIST argument list.\r |
9b002aa4 HW |
203 | \r |
204 | This function is similar as vsnprintf_s defined in C11.\r | |
205 | \r | |
488ee641 | 206 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r |
9b002aa4 HW |
207 | and BufferSize.\r |
208 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
209 | Arguments are pulled from the variable argument list specified by Marker based on the\r | |
210 | contents of the format string.\r | |
211 | The number of Unicode characters in the produced output buffer is returned not including\r | |
488ee641 | 212 | the Null-terminator.\r |
488ee641 | 213 | \r |
9b002aa4 HW |
214 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r |
215 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
216 | \r | |
217 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
218 | unmodified and 0 is returned.\r | |
219 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
220 | unmodified and 0 is returned.\r | |
221 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
222 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
223 | buffer is unmodified and 0 is returned.\r | |
224 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r | |
225 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
226 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
227 | \r | |
228 | If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.\r | |
229 | \r | |
230 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r | |
488ee641 | 231 | Unicode string.\r |
232 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
9b002aa4 | 233 | @param FormatString A Null-terminated Unicode format string.\r |
488ee641 | 234 | @param Marker VA_LIST marker for the variable argument list.\r |
9b002aa4 HW |
235 | \r |
236 | @return The number of Unicode characters in the produced output buffer not including the\r | |
488ee641 | 237 | Null-terminator.\r |
238 | \r | |
239 | **/\r | |
240 | UINTN\r | |
241 | EFIAPI\r | |
242 | UnicodeVSPrint (\r | |
243 | OUT CHAR16 *StartOfBuffer,\r | |
244 | IN UINTN BufferSize,\r | |
245 | IN CONST CHAR16 *FormatString,\r | |
246 | IN VA_LIST Marker\r | |
247 | );\r | |
248 | \r | |
2075236e | 249 | /**\r |
9b002aa4 | 250 | Produces a Null-terminated Unicode string in an output buffer based on\r |
af2dc6a7 | 251 | a Null-terminated Unicode format string and a BASE_LIST argument list.\r |
9b002aa4 | 252 | \r |
2075236e | 253 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r |
9b002aa4 HW |
254 | and BufferSize.\r |
255 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
256 | Arguments are pulled from the variable argument list specified by Marker based on the\r | |
257 | contents of the format string.\r | |
258 | The number of Unicode characters in the produced output buffer is returned not including\r | |
2075236e | 259 | the Null-terminator.\r |
2075236e | 260 | \r |
9b002aa4 HW |
261 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r |
262 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
263 | \r | |
264 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
265 | unmodified and 0 is returned.\r | |
266 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
267 | unmodified and 0 is returned.\r | |
268 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
269 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
270 | buffer is unmodified and 0 is returned.\r | |
271 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r | |
272 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
273 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
274 | \r | |
275 | If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.\r | |
276 | \r | |
277 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r | |
2075236e | 278 | Unicode string.\r |
279 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
9b002aa4 | 280 | @param FormatString A Null-terminated Unicode format string.\r |
2075236e | 281 | @param Marker BASE_LIST marker for the variable argument list.\r |
9b002aa4 HW |
282 | \r |
283 | @return The number of Unicode characters in the produced output buffer not including the\r | |
2075236e | 284 | Null-terminator.\r |
285 | \r | |
286 | **/\r | |
287 | UINTN\r | |
288 | EFIAPI\r | |
289 | UnicodeBSPrint (\r | |
290 | OUT CHAR16 *StartOfBuffer,\r | |
291 | IN UINTN BufferSize,\r | |
292 | IN CONST CHAR16 *FormatString,\r | |
293 | IN BASE_LIST Marker\r | |
294 | );\r | |
295 | \r | |
488ee641 | 296 | /**\r |
9b002aa4 | 297 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r |
488ee641 | 298 | Unicode format string and variable argument list.\r |
9b002aa4 HW |
299 | \r |
300 | This function is similar as snprintf_s defined in C11.\r | |
301 | \r | |
488ee641 | 302 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r |
303 | and BufferSize.\r | |
304 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
305 | Arguments are pulled from the variable argument list based on the contents of the format string.\r | |
9b002aa4 | 306 | The number of Unicode characters in the produced output buffer is returned not including\r |
488ee641 | 307 | the Null-terminator.\r |
488ee641 | 308 | \r |
9b002aa4 HW |
309 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r |
310 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
311 | \r | |
312 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
313 | unmodified and 0 is returned.\r | |
314 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
315 | unmodified and 0 is returned.\r | |
316 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
317 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
318 | buffer is unmodified and 0 is returned.\r | |
319 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r | |
488ee641 | 320 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r |
9b002aa4 HW |
321 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r |
322 | \r | |
323 | If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.\r | |
488ee641 | 324 | \r |
9b002aa4 | 325 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
488ee641 | 326 | Unicode string.\r |
327 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
9b002aa4 HW |
328 | @param FormatString A Null-terminated Unicode format string.\r |
329 | @param ... Variable argument list whose contents are accessed based on the\r | |
285010e7 | 330 | format string specified by FormatString.\r |
9b002aa4 HW |
331 | \r |
332 | @return The number of Unicode characters in the produced output buffer not including the\r | |
488ee641 | 333 | Null-terminator.\r |
334 | \r | |
335 | **/\r | |
336 | UINTN\r | |
337 | EFIAPI\r | |
338 | UnicodeSPrint (\r | |
339 | OUT CHAR16 *StartOfBuffer,\r | |
340 | IN UINTN BufferSize,\r | |
341 | IN CONST CHAR16 *FormatString,\r | |
342 | ...\r | |
343 | );\r | |
344 | \r | |
345 | /**\r | |
346 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r | |
9b002aa4 HW |
347 | ASCII format string and a VA_LIST argument list.\r |
348 | \r | |
349 | This function is similar as vsnprintf_s defined in C11.\r | |
350 | \r | |
488ee641 | 351 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r |
352 | and BufferSize.\r | |
353 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 354 | Arguments are pulled from the variable argument list specified by Marker based on the\r |
488ee641 | 355 | contents of the format string.\r |
9b002aa4 | 356 | The number of Unicode characters in the produced output buffer is returned not including\r |
488ee641 | 357 | the Null-terminator.\r |
488ee641 | 358 | \r |
9b002aa4 HW |
359 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r |
360 | \r | |
361 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
362 | unmodified and 0 is returned.\r | |
363 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
364 | unmodified and 0 is returned.\r | |
365 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
366 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
367 | buffer is unmodified and 0 is returned.\r | |
488ee641 | 368 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
369 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
370 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
488ee641 | 371 | \r |
9b002aa4 HW |
372 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r |
373 | \r | |
374 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r | |
488ee641 | 375 | Unicode string.\r |
376 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
9b002aa4 | 377 | @param FormatString A Null-terminated ASCII format string.\r |
488ee641 | 378 | @param Marker VA_LIST marker for the variable argument list.\r |
9b002aa4 | 379 | \r |
488ee641 | 380 | @return The number of Unicode characters in the produced output buffer not including the\r |
381 | Null-terminator.\r | |
382 | \r | |
383 | **/\r | |
384 | UINTN\r | |
385 | EFIAPI\r | |
386 | UnicodeVSPrintAsciiFormat (\r | |
387 | OUT CHAR16 *StartOfBuffer,\r | |
388 | IN UINTN BufferSize,\r | |
389 | IN CONST CHAR8 *FormatString,\r | |
390 | IN VA_LIST Marker\r | |
391 | );\r | |
392 | \r | |
2075236e | 393 | /**\r |
394 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r | |
9b002aa4 HW |
395 | ASCII format string and a BASE_LIST argument list.\r |
396 | \r | |
2075236e | 397 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r |
398 | and BufferSize.\r | |
399 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 400 | Arguments are pulled from the variable argument list specified by Marker based on the\r |
2075236e | 401 | contents of the format string.\r |
9b002aa4 | 402 | The number of Unicode characters in the produced output buffer is returned not including\r |
2075236e | 403 | the Null-terminator.\r |
2075236e | 404 | \r |
9b002aa4 HW |
405 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r |
406 | \r | |
407 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
408 | unmodified and 0 is returned.\r | |
409 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
410 | unmodified and 0 is returned.\r | |
411 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
412 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
413 | buffer is unmodified and 0 is returned.\r | |
2075236e | 414 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
415 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
416 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
2075236e | 417 | \r |
9b002aa4 HW |
418 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r |
419 | \r | |
420 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r | |
2075236e | 421 | Unicode string.\r |
422 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
9b002aa4 HW |
423 | @param FormatString A Null-terminated ASCII format string.\r |
424 | @param Marker BASE_LIST marker for the variable argument list.\r | |
425 | \r | |
426 | @return The number of Unicode characters in the produced output buffer not including the\r | |
2075236e | 427 | Null-terminator.\r |
428 | \r | |
429 | **/\r | |
430 | UINTN\r | |
431 | EFIAPI\r | |
432 | UnicodeBSPrintAsciiFormat (\r | |
433 | OUT CHAR16 *StartOfBuffer,\r | |
434 | IN UINTN BufferSize,\r | |
435 | IN CONST CHAR8 *FormatString,\r | |
436 | IN BASE_LIST Marker\r | |
437 | );\r | |
438 | \r | |
488ee641 | 439 | /**\r |
9b002aa4 | 440 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r |
488ee641 | 441 | ASCII format string and variable argument list.\r |
9b002aa4 HW |
442 | \r |
443 | This function is similar as snprintf_s defined in C11.\r | |
444 | \r | |
488ee641 | 445 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r |
446 | and BufferSize.\r | |
447 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 448 | Arguments are pulled from the variable argument list based on the contents of the\r |
488ee641 | 449 | format string.\r |
9b002aa4 | 450 | The number of Unicode characters in the produced output buffer is returned not including\r |
488ee641 | 451 | the Null-terminator.\r |
488ee641 | 452 | \r |
9b002aa4 HW |
453 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r |
454 | \r | |
455 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
456 | unmodified and 0 is returned.\r | |
457 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
458 | unmodified and 0 is returned.\r | |
459 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
460 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
461 | buffer is unmodified and 0 is returned.\r | |
488ee641 | 462 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
463 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
464 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
465 | \r | |
466 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r | |
488ee641 | 467 | \r |
9b002aa4 | 468 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
488ee641 | 469 | Unicode string.\r |
470 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
9b002aa4 HW |
471 | @param FormatString A Null-terminated ASCII format string.\r |
472 | @param ... Variable argument list whose contents are accessed based on the\r | |
285010e7 | 473 | format string specified by FormatString.\r |
9b002aa4 HW |
474 | \r |
475 | @return The number of Unicode characters in the produced output buffer not including the\r | |
488ee641 | 476 | Null-terminator.\r |
477 | \r | |
478 | **/\r | |
479 | UINTN\r | |
480 | EFIAPI\r | |
481 | UnicodeSPrintAsciiFormat (\r | |
482 | OUT CHAR16 *StartOfBuffer,\r | |
483 | IN UINTN BufferSize,\r | |
484 | IN CONST CHAR8 *FormatString,\r | |
485 | ...\r | |
486 | );\r | |
487 | \r | |
51f0ceb4 HW |
488 | /**\r |
489 | Converts a decimal value to a Null-terminated Unicode string.\r | |
490 | \r | |
491 | Converts the decimal number specified by Value to a Null-terminated Unicode\r | |
492 | string specified by Buffer containing at most Width characters. No padding of\r | |
493 | spaces is ever performed. If Width is 0 then a width of\r | |
494 | MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than\r | |
495 | Width characters, then only the first Width characters are placed in Buffer.\r | |
496 | Additional conversion parameters are specified in Flags.\r | |
497 | \r | |
498 | The Flags bit LEFT_JUSTIFY is always ignored.\r | |
499 | All conversions are left justified in Buffer.\r | |
500 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
501 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and\r | |
502 | commas are inserted every 3rd digit starting from the right.\r | |
503 | If RADIX_HEX is set in Flags, then the output buffer will be formatted in\r | |
504 | hexadecimal format.\r | |
505 | If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in\r | |
506 | Buffer is a '-'.\r | |
507 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then\r | |
508 | Buffer is padded with '0' characters so the combination of the optional '-'\r | |
509 | sign character, '0' characters, digit characters for Value, and the\r | |
510 | Null-terminator add up to Width characters.\r | |
511 | \r | |
512 | If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
513 | If an error would be returned, then the function will also ASSERT().\r | |
514 | \r | |
515 | @param Buffer The pointer to the output buffer for the produced\r | |
516 | Null-terminated Unicode string.\r | |
517 | @param BufferSize The size of Buffer in bytes, including the\r | |
518 | Null-terminator.\r | |
519 | @param Flags The bitmask of flags that specify left justification,\r | |
520 | zero pad, and commas.\r | |
521 | @param Value The 64-bit signed value to convert to a string.\r | |
522 | @param Width The maximum number of Unicode characters to place in\r | |
523 | Buffer, not including the Null-terminator.\r | |
524 | \r | |
525 | @retval RETURN_SUCCESS The decimal value is converted.\r | |
526 | @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted\r | |
527 | value.\r | |
528 | @retval RETURN_INVALID_PARAMETER If Buffer is NULL.\r | |
529 | If PcdMaximumUnicodeStringLength is not\r | |
530 | zero, and BufferSize is greater than\r | |
531 | (PcdMaximumUnicodeStringLength *\r | |
532 | sizeof (CHAR16) + 1).\r | |
533 | If unsupported bits are set in Flags.\r | |
534 | If both COMMA_TYPE and RADIX_HEX are set in\r | |
535 | Flags.\r | |
536 | If Width >= MAXIMUM_VALUE_CHARACTERS.\r | |
537 | \r | |
538 | **/\r | |
539 | RETURN_STATUS\r | |
540 | EFIAPI\r | |
541 | UnicodeValueToStringS (\r | |
542 | IN OUT CHAR16 *Buffer,\r | |
543 | IN UINTN BufferSize,\r | |
544 | IN UINTN Flags,\r | |
545 | IN INT64 Value,\r | |
546 | IN UINTN Width\r | |
547 | );\r | |
548 | \r | |
488ee641 | 549 | /**\r |
550 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
551 | ASCII format string and a VA_LIST argument list.\r | |
9b002aa4 HW |
552 | \r |
553 | This function is similar as vsnprintf_s defined in C11.\r | |
554 | \r | |
488ee641 | 555 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r |
556 | and BufferSize.\r | |
557 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 558 | Arguments are pulled from the variable argument list specified by Marker based on\r |
488ee641 | 559 | the contents of the format string.\r |
9b002aa4 | 560 | The number of ASCII characters in the produced output buffer is returned not including\r |
488ee641 | 561 | the Null-terminator.\r |
488ee641 | 562 | \r |
9b002aa4 HW |
563 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r |
564 | unmodified and 0 is returned.\r | |
565 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
566 | unmodified and 0 is returned.\r | |
567 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
568 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
569 | is unmodified and 0 is returned.\r | |
488ee641 | 570 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
571 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
572 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
573 | \r | |
574 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
488ee641 | 575 | \r |
9b002aa4 | 576 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
488ee641 | 577 | ASCII string.\r |
578 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
9b002aa4 | 579 | @param FormatString A Null-terminated ASCII format string.\r |
488ee641 | 580 | @param Marker VA_LIST marker for the variable argument list.\r |
9b002aa4 HW |
581 | \r |
582 | @return The number of ASCII characters in the produced output buffer not including the\r | |
488ee641 | 583 | Null-terminator.\r |
584 | \r | |
585 | **/\r | |
586 | UINTN\r | |
587 | EFIAPI\r | |
588 | AsciiVSPrint (\r | |
2f88bd3a MK |
589 | OUT CHAR8 *StartOfBuffer,\r |
590 | IN UINTN BufferSize,\r | |
591 | IN CONST CHAR8 *FormatString,\r | |
592 | IN VA_LIST Marker\r | |
488ee641 | 593 | );\r |
594 | \r | |
2075236e | 595 | /**\r |
596 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
597 | ASCII format string and a BASE_LIST argument list.\r | |
9b002aa4 | 598 | \r |
2075236e | 599 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r |
600 | and BufferSize.\r | |
601 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 602 | Arguments are pulled from the variable argument list specified by Marker based on\r |
2075236e | 603 | the contents of the format string.\r |
9b002aa4 | 604 | The number of ASCII characters in the produced output buffer is returned not including\r |
2075236e | 605 | the Null-terminator.\r |
2075236e | 606 | \r |
9b002aa4 HW |
607 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r |
608 | unmodified and 0 is returned.\r | |
609 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
610 | unmodified and 0 is returned.\r | |
611 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
612 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
613 | is unmodified and 0 is returned.\r | |
2075236e | 614 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
615 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
616 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
617 | \r | |
618 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
2075236e | 619 | \r |
9b002aa4 | 620 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
2075236e | 621 | ASCII string.\r |
622 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
9b002aa4 | 623 | @param FormatString A Null-terminated ASCII format string.\r |
2075236e | 624 | @param Marker BASE_LIST marker for the variable argument list.\r |
9b002aa4 HW |
625 | \r |
626 | @return The number of ASCII characters in the produced output buffer not including the\r | |
2075236e | 627 | Null-terminator.\r |
628 | \r | |
629 | **/\r | |
630 | UINTN\r | |
631 | EFIAPI\r | |
632 | AsciiBSPrint (\r | |
2f88bd3a MK |
633 | OUT CHAR8 *StartOfBuffer,\r |
634 | IN UINTN BufferSize,\r | |
635 | IN CONST CHAR8 *FormatString,\r | |
636 | IN BASE_LIST Marker\r | |
2075236e | 637 | );\r |
638 | \r | |
488ee641 | 639 | /**\r |
640 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
641 | ASCII format string and variable argument list.\r | |
9b002aa4 HW |
642 | \r |
643 | This function is similar as snprintf_s defined in C11.\r | |
644 | \r | |
488ee641 | 645 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r |
646 | and BufferSize.\r | |
647 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 648 | Arguments are pulled from the variable argument list based on the contents of the\r |
488ee641 | 649 | format string.\r |
9b002aa4 | 650 | The number of ASCII characters in the produced output buffer is returned not including\r |
488ee641 | 651 | the Null-terminator.\r |
488ee641 | 652 | \r |
9b002aa4 HW |
653 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r |
654 | unmodified and 0 is returned.\r | |
655 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
656 | unmodified and 0 is returned.\r | |
657 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
658 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
659 | is unmodified and 0 is returned.\r | |
488ee641 | 660 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
661 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
662 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
663 | \r | |
664 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
488ee641 | 665 | \r |
9b002aa4 | 666 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
488ee641 | 667 | ASCII string.\r |
668 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
9b002aa4 HW |
669 | @param FormatString A Null-terminated ASCII format string.\r |
670 | @param ... Variable argument list whose contents are accessed based on the\r | |
285010e7 | 671 | format string specified by FormatString.\r |
9b002aa4 HW |
672 | \r |
673 | @return The number of ASCII characters in the produced output buffer not including the\r | |
488ee641 | 674 | Null-terminator.\r |
675 | \r | |
676 | **/\r | |
677 | UINTN\r | |
678 | EFIAPI\r | |
679 | AsciiSPrint (\r | |
680 | OUT CHAR8 *StartOfBuffer,\r | |
681 | IN UINTN BufferSize,\r | |
682 | IN CONST CHAR8 *FormatString,\r | |
683 | ...\r | |
684 | );\r | |
685 | \r | |
686 | /**\r | |
687 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
688 | Unicode format string and a VA_LIST argument list.\r | |
9b002aa4 HW |
689 | \r |
690 | This function is similar as vsnprintf_s defined in C11.\r | |
691 | \r | |
488ee641 | 692 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r |
693 | and BufferSize.\r | |
694 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 695 | Arguments are pulled from the variable argument list specified by Marker based on\r |
488ee641 | 696 | the contents of the format string.\r |
9b002aa4 | 697 | The number of ASCII characters in the produced output buffer is returned not including\r |
488ee641 | 698 | the Null-terminator.\r |
488ee641 | 699 | \r |
9b002aa4 HW |
700 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r |
701 | \r | |
702 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
703 | unmodified and 0 is returned.\r | |
704 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
705 | unmodified and 0 is returned.\r | |
706 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
707 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
708 | is unmodified and 0 is returned.\r | |
488ee641 | 709 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
710 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r |
711 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
712 | \r | |
713 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
488ee641 | 714 | \r |
9b002aa4 | 715 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
488ee641 | 716 | ASCII string.\r |
717 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
9b002aa4 | 718 | @param FormatString A Null-terminated Unicode format string.\r |
488ee641 | 719 | @param Marker VA_LIST marker for the variable argument list.\r |
9b002aa4 HW |
720 | \r |
721 | @return The number of ASCII characters in the produced output buffer not including the\r | |
488ee641 | 722 | Null-terminator.\r |
723 | \r | |
724 | **/\r | |
725 | UINTN\r | |
726 | EFIAPI\r | |
727 | AsciiVSPrintUnicodeFormat (\r | |
728 | OUT CHAR8 *StartOfBuffer,\r | |
729 | IN UINTN BufferSize,\r | |
730 | IN CONST CHAR16 *FormatString,\r | |
731 | IN VA_LIST Marker\r | |
732 | );\r | |
733 | \r | |
2075236e | 734 | /**\r |
735 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
736 | Unicode format string and a BASE_LIST argument list.\r | |
9b002aa4 | 737 | \r |
2075236e | 738 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r |
739 | and BufferSize.\r | |
740 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 741 | Arguments are pulled from the variable argument list specified by Marker based on\r |
2075236e | 742 | the contents of the format string.\r |
9b002aa4 | 743 | The number of ASCII characters in the produced output buffer is returned not including\r |
2075236e | 744 | the Null-terminator.\r |
2075236e | 745 | \r |
9b002aa4 HW |
746 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r |
747 | \r | |
748 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
749 | unmodified and 0 is returned.\r | |
750 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
751 | unmodified and 0 is returned.\r | |
752 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
753 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
754 | is unmodified and 0 is returned.\r | |
2075236e | 755 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
756 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r |
757 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
2075236e | 758 | \r |
9b002aa4 HW |
759 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r |
760 | \r | |
761 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r | |
2075236e | 762 | ASCII string.\r |
763 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
9b002aa4 | 764 | @param FormatString A Null-terminated Unicode format string.\r |
2075236e | 765 | @param Marker BASE_LIST marker for the variable argument list.\r |
9b002aa4 HW |
766 | \r |
767 | @return The number of ASCII characters in the produced output buffer not including the\r | |
2075236e | 768 | Null-terminator.\r |
769 | \r | |
770 | **/\r | |
771 | UINTN\r | |
772 | EFIAPI\r | |
773 | AsciiBSPrintUnicodeFormat (\r | |
774 | OUT CHAR8 *StartOfBuffer,\r | |
775 | IN UINTN BufferSize,\r | |
776 | IN CONST CHAR16 *FormatString,\r | |
777 | IN BASE_LIST Marker\r | |
778 | );\r | |
779 | \r | |
488ee641 | 780 | /**\r |
781 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
782 | Unicode format string and variable argument list.\r | |
9b002aa4 HW |
783 | \r |
784 | This function is similar as snprintf_s defined in C11.\r | |
785 | \r | |
488ee641 | 786 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r |
787 | and BufferSize.\r | |
788 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 789 | Arguments are pulled from the variable argument list based on the contents of the\r |
488ee641 | 790 | format string.\r |
9b002aa4 | 791 | The number of ASCII characters in the produced output buffer is returned not including\r |
488ee641 | 792 | the Null-terminator.\r |
488ee641 | 793 | \r |
9b002aa4 HW |
794 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r |
795 | \r | |
796 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
797 | unmodified and 0 is returned.\r | |
798 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
799 | unmodified and 0 is returned.\r | |
800 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
801 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
802 | is unmodified and 0 is returned.\r | |
488ee641 | 803 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
804 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r |
805 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
806 | \r | |
807 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
488ee641 | 808 | \r |
9b002aa4 | 809 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
488ee641 | 810 | ASCII string.\r |
811 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
9b002aa4 HW |
812 | @param FormatString A Null-terminated Unicode format string.\r |
813 | @param ... Variable argument list whose contents are accessed based on the\r | |
285010e7 | 814 | format string specified by FormatString.\r |
9b002aa4 HW |
815 | \r |
816 | @return The number of ASCII characters in the produced output buffer not including the\r | |
488ee641 | 817 | Null-terminator.\r |
818 | \r | |
819 | **/\r | |
820 | UINTN\r | |
821 | EFIAPI\r | |
822 | AsciiSPrintUnicodeFormat (\r | |
823 | OUT CHAR8 *StartOfBuffer,\r | |
824 | IN UINTN BufferSize,\r | |
825 | IN CONST CHAR16 *FormatString,\r | |
826 | ...\r | |
827 | );\r | |
828 | \r | |
51f0ceb4 HW |
829 | /**\r |
830 | Converts a decimal value to a Null-terminated Ascii string.\r | |
831 | \r | |
832 | Converts the decimal number specified by Value to a Null-terminated Ascii\r | |
833 | string specified by Buffer containing at most Width characters. No padding of\r | |
834 | spaces is ever performed. If Width is 0 then a width of\r | |
835 | MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than\r | |
836 | Width characters, then only the first Width characters are placed in Buffer.\r | |
837 | Additional conversion parameters are specified in Flags.\r | |
838 | \r | |
839 | The Flags bit LEFT_JUSTIFY is always ignored.\r | |
840 | All conversions are left justified in Buffer.\r | |
841 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
842 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and\r | |
843 | commas are inserted every 3rd digit starting from the right.\r | |
844 | If RADIX_HEX is set in Flags, then the output buffer will be formatted in\r | |
845 | hexadecimal format.\r | |
846 | If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in\r | |
847 | Buffer is a '-'.\r | |
848 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then\r | |
849 | Buffer is padded with '0' characters so the combination of the optional '-'\r | |
850 | sign character, '0' characters, digit characters for Value, and the\r | |
851 | Null-terminator add up to Width characters.\r | |
852 | \r | |
5923ef92 | 853 | If an error would be returned, then the function will ASSERT().\r |
51f0ceb4 HW |
854 | \r |
855 | @param Buffer The pointer to the output buffer for the produced\r | |
856 | Null-terminated Ascii string.\r | |
857 | @param BufferSize The size of Buffer in bytes, including the\r | |
858 | Null-terminator.\r | |
859 | @param Flags The bitmask of flags that specify left justification,\r | |
860 | zero pad, and commas.\r | |
861 | @param Value The 64-bit signed value to convert to a string.\r | |
862 | @param Width The maximum number of Ascii characters to place in\r | |
863 | Buffer, not including the Null-terminator.\r | |
864 | \r | |
865 | @retval RETURN_SUCCESS The decimal value is converted.\r | |
866 | @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted\r | |
867 | value.\r | |
868 | @retval RETURN_INVALID_PARAMETER If Buffer is NULL.\r | |
869 | If PcdMaximumAsciiStringLength is not\r | |
870 | zero, and BufferSize is greater than\r | |
871 | PcdMaximumAsciiStringLength.\r | |
872 | If unsupported bits are set in Flags.\r | |
873 | If both COMMA_TYPE and RADIX_HEX are set in\r | |
874 | Flags.\r | |
875 | If Width >= MAXIMUM_VALUE_CHARACTERS.\r | |
876 | \r | |
877 | **/\r | |
878 | RETURN_STATUS\r | |
879 | EFIAPI\r | |
880 | AsciiValueToStringS (\r | |
2f88bd3a MK |
881 | IN OUT CHAR8 *Buffer,\r |
882 | IN UINTN BufferSize,\r | |
883 | IN UINTN Flags,\r | |
884 | IN INT64 Value,\r | |
885 | IN UINTN Width\r | |
51f0ceb4 HW |
886 | );\r |
887 | \r | |
f405c067 | 888 | /**\r |
9095d37b | 889 | Returns the number of characters that would be produced by if the formatted\r |
f405c067 | 890 | output were produced not including the Null-terminator.\r |
891 | \r | |
9b002aa4 HW |
892 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r |
893 | \r | |
894 | If FormatString is NULL, then ASSERT() and 0 is returned.\r | |
895 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more\r | |
896 | than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
897 | Null-terminator, then ASSERT() and 0 is returned.\r | |
f405c067 | 898 | \r |
899 | @param[in] FormatString A Null-terminated Unicode format string.\r | |
900 | @param[in] Marker VA_LIST marker for the variable argument list.\r | |
901 | \r | |
9095d37b | 902 | @return The number of characters that would be produced, not including the\r |
f405c067 | 903 | Null-terminator.\r |
904 | **/\r | |
905 | UINTN\r | |
906 | EFIAPI\r | |
907 | SPrintLength (\r | |
2f88bd3a | 908 | IN CONST CHAR16 *FormatString,\r |
f405c067 | 909 | IN VA_LIST Marker\r |
910 | );\r | |
911 | \r | |
912 | /**\r | |
9095d37b | 913 | Returns the number of characters that would be produced by if the formatted\r |
f405c067 | 914 | output were produced not including the Null-terminator.\r |
915 | \r | |
9b002aa4 HW |
916 | If FormatString is NULL, then ASSERT() and 0 is returned.\r |
917 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more\r | |
918 | than PcdMaximumAsciiStringLength Ascii characters not including the\r | |
919 | Null-terminator, then ASSERT() and 0 is returned.\r | |
f405c067 | 920 | \r |
921 | @param[in] FormatString A Null-terminated ASCII format string.\r | |
922 | @param[in] Marker VA_LIST marker for the variable argument list.\r | |
923 | \r | |
9095d37b | 924 | @return The number of characters that would be produced, not including the\r |
f405c067 | 925 | Null-terminator.\r |
926 | **/\r | |
927 | UINTN\r | |
928 | EFIAPI\r | |
929 | SPrintLengthAsciiFormat (\r | |
2f88bd3a MK |
930 | IN CONST CHAR8 *FormatString,\r |
931 | IN VA_LIST Marker\r | |
f405c067 | 932 | );\r |
933 | \r | |
488ee641 | 934 | #endif\r |