]>
Commit | Line | Data |
---|---|---|
e1f414b6 | 1 | /** @file\r |
eceb3a4c | 2 | Base Print Library instance implementation.\r |
e1f414b6 | 3 | \r |
9095d37b | 4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
19388d29 | 5 | Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r |
9344f092 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
e1f414b6 | 7 | \r |
e1f414b6 | 8 | **/\r |
9 | \r | |
e1f414b6 | 10 | #include "PrintLibInternal.h"\r |
11 | \r | |
ebd04fc2 | 12 | //\r |
b5a6c9d9 | 13 | // Declare a VA_LIST global variable that is used in calls to BasePrintLibSPrintMarker()\r |
9095d37b LG |
14 | // when the BASE_LIST parameter is valid and the VA_LIST parameter is ignored.\r |
15 | // A NULL VA_LIST can not be passed into BasePrintLibSPrintMarker() because some\r | |
ebd04fc2 | 16 | // compilers define VA_LIST to be a structure.\r |
17 | //\r | |
b5a6c9d9 | 18 | VA_LIST gNullVaList;\r |
ebd04fc2 | 19 | \r |
e1f414b6 | 20 | #define ASSERT_UNICODE_BUFFER(Buffer) ASSERT ((((UINTN) (Buffer)) & 0x01) == 0)\r |
21 | \r | |
e1f414b6 | 22 | /**\r |
9b002aa4 HW |
23 | Produces a Null-terminated Unicode string in an output buffer based on\r |
24 | a Null-terminated Unicode format string and a VA_LIST argument list.\r | |
25 | \r | |
26 | This function is similar as vsnprintf_s defined in C11.\r | |
27 | \r | |
e1f414b6 | 28 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r |
9b002aa4 HW |
29 | and BufferSize.\r |
30 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
31 | Arguments are pulled from the variable argument list specified by Marker based on the\r | |
32 | contents of the format string.\r | |
e1f414b6 | 33 | The number of Unicode characters in the produced output buffer is returned not including\r |
34 | the Null-terminator.\r | |
e1f414b6 | 35 | \r |
9b002aa4 HW |
36 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r |
37 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
38 | \r | |
39 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
40 | unmodified and 0 is returned.\r | |
41 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
42 | unmodified and 0 is returned.\r | |
43 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
44 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
45 | buffer is unmodified and 0 is returned.\r | |
46 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r | |
e1f414b6 | 47 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r |
9b002aa4 | 48 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r |
e1f414b6 | 49 | \r |
9b002aa4 HW |
50 | If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.\r |
51 | \r | |
52 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r | |
e1f414b6 | 53 | Unicode string.\r |
54 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
2fc59a00 | 55 | @param FormatString A Null-terminated Unicode format string.\r |
e1f414b6 | 56 | @param Marker VA_LIST marker for the variable argument list.\r |
9b002aa4 | 57 | \r |
e1f414b6 | 58 | @return The number of Unicode characters in the produced output buffer not including the\r |
59 | Null-terminator.\r | |
60 | \r | |
61 | **/\r | |
62 | UINTN\r | |
63 | EFIAPI\r | |
64 | UnicodeVSPrint (\r | |
65 | OUT CHAR16 *StartOfBuffer,\r | |
66 | IN UINTN BufferSize,\r | |
67 | IN CONST CHAR16 *FormatString,\r | |
68 | IN VA_LIST Marker\r | |
69 | )\r | |
70 | {\r | |
2075236e | 71 | ASSERT_UNICODE_BUFFER (StartOfBuffer);\r |
72 | ASSERT_UNICODE_BUFFER (FormatString);\r | |
73 | return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, Marker, NULL);\r | |
74 | }\r | |
75 | \r | |
76 | /**\r | |
9b002aa4 HW |
77 | Produces a Null-terminated Unicode string in an output buffer based on\r |
78 | a Null-terminated Unicode format string and a BASE_LIST argument list.\r | |
79 | \r | |
2075236e | 80 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r |
9b002aa4 HW |
81 | and BufferSize.\r |
82 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
83 | Arguments are pulled from the variable argument list specified by Marker based on the\r | |
84 | contents of the format string.\r | |
2075236e | 85 | The number of Unicode characters in the produced output buffer is returned not including\r |
86 | the Null-terminator.\r | |
2075236e | 87 | \r |
9b002aa4 HW |
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 | |
2075236e | 99 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r |
9b002aa4 HW |
100 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r |
101 | \r | |
102 | If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.\r | |
2075236e | 103 | \r |
9b002aa4 | 104 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
2075236e | 105 | Unicode string.\r |
106 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
2fc59a00 | 107 | @param FormatString A Null-terminated Unicode format string.\r |
2075236e | 108 | @param Marker BASE_LIST marker for the variable argument list.\r |
9b002aa4 | 109 | \r |
2075236e | 110 | @return The number of Unicode characters in the produced output buffer not including the\r |
111 | Null-terminator.\r | |
112 | \r | |
113 | **/\r | |
114 | UINTN\r | |
115 | EFIAPI\r | |
116 | UnicodeBSPrint (\r | |
117 | OUT CHAR16 *StartOfBuffer,\r | |
118 | IN UINTN BufferSize,\r | |
119 | IN CONST CHAR16 *FormatString,\r | |
120 | IN BASE_LIST Marker\r | |
121 | )\r | |
122 | {\r | |
123 | ASSERT_UNICODE_BUFFER (StartOfBuffer);\r | |
124 | ASSERT_UNICODE_BUFFER (FormatString);\r | |
ebd04fc2 | 125 | return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, gNullVaList, Marker);\r |
e1f414b6 | 126 | }\r |
127 | \r | |
128 | /**\r | |
9b002aa4 | 129 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r |
e1f414b6 | 130 | Unicode format string and variable argument list.\r |
9b002aa4 HW |
131 | \r |
132 | This function is similar as snprintf_s defined in C11.\r | |
133 | \r | |
e1f414b6 | 134 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r |
135 | and BufferSize.\r | |
136 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
137 | Arguments are pulled from the variable argument list based on the contents of the format string.\r | |
138 | The number of Unicode characters in the produced output buffer is returned not including\r | |
139 | the Null-terminator.\r | |
e1f414b6 | 140 | \r |
9b002aa4 HW |
141 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r |
142 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
143 | \r | |
144 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
145 | unmodified and 0 is returned.\r | |
146 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
147 | unmodified and 0 is returned.\r | |
148 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
149 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
150 | buffer is unmodified and 0 is returned.\r | |
151 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r | |
e1f414b6 | 152 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r |
9b002aa4 HW |
153 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r |
154 | \r | |
155 | If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned.\r | |
e1f414b6 | 156 | \r |
9b002aa4 | 157 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
e1f414b6 | 158 | Unicode string.\r |
159 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
2fc59a00 | 160 | @param FormatString A Null-terminated Unicode format string.\r |
9b002aa4 | 161 | @param ... Variable argument list whose contents are accessed based on the\r |
285010e7 | 162 | format string specified by FormatString.\r |
9b002aa4 | 163 | \r |
e1f414b6 | 164 | @return The number of Unicode characters in the produced output buffer not including the\r |
165 | Null-terminator.\r | |
166 | \r | |
167 | **/\r | |
168 | UINTN\r | |
169 | EFIAPI\r | |
170 | UnicodeSPrint (\r | |
171 | OUT CHAR16 *StartOfBuffer,\r | |
172 | IN UINTN BufferSize,\r | |
173 | IN CONST CHAR16 *FormatString,\r | |
174 | ...\r | |
175 | )\r | |
176 | {\r | |
177 | VA_LIST Marker;\r | |
3bbe68a3 | 178 | UINTN NumberOfPrinted;\r |
e1f414b6 | 179 | \r |
180 | VA_START (Marker, FormatString);\r | |
3bbe68a3 | 181 | NumberOfPrinted = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r |
182 | VA_END (Marker);\r | |
183 | return NumberOfPrinted;\r | |
e1f414b6 | 184 | }\r |
185 | \r | |
186 | /**\r | |
187 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r | |
9b002aa4 HW |
188 | ASCII format string and a VA_LIST argument list.\r |
189 | \r | |
190 | This function is similar as vsnprintf_s defined in C11.\r | |
191 | \r | |
e1f414b6 | 192 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r |
193 | and BufferSize.\r | |
194 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 195 | Arguments are pulled from the variable argument list specified by Marker based on the\r |
e1f414b6 | 196 | contents of the format string.\r |
197 | The number of Unicode characters in the produced output buffer is returned not including\r | |
198 | the Null-terminator.\r | |
e1f414b6 | 199 | \r |
9b002aa4 HW |
200 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r |
201 | \r | |
202 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
203 | unmodified and 0 is returned.\r | |
204 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
205 | unmodified and 0 is returned.\r | |
206 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
207 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
208 | buffer is unmodified and 0 is returned.\r | |
e1f414b6 | 209 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
210 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
211 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
e1f414b6 | 212 | \r |
9b002aa4 HW |
213 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r |
214 | \r | |
215 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r | |
e1f414b6 | 216 | Unicode string.\r |
217 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
2fc59a00 | 218 | @param FormatString A Null-terminated ASCII format string.\r |
e1f414b6 | 219 | @param Marker VA_LIST marker for the variable argument list.\r |
9b002aa4 | 220 | \r |
e1f414b6 | 221 | @return The number of Unicode characters in the produced output buffer not including the\r |
222 | Null-terminator.\r | |
223 | \r | |
224 | **/\r | |
225 | UINTN\r | |
226 | EFIAPI\r | |
227 | UnicodeVSPrintAsciiFormat (\r | |
228 | OUT CHAR16 *StartOfBuffer,\r | |
229 | IN UINTN BufferSize,\r | |
230 | IN CONST CHAR8 *FormatString,\r | |
231 | IN VA_LIST Marker\r | |
232 | )\r | |
233 | {\r | |
2075236e | 234 | ASSERT_UNICODE_BUFFER (StartOfBuffer);\r |
235 | return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE, FormatString, Marker, NULL);\r | |
236 | }\r | |
237 | \r | |
238 | /**\r | |
239 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r | |
9b002aa4 HW |
240 | ASCII format string and a BASE_LIST argument list.\r |
241 | \r | |
2075236e | 242 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r |
243 | and BufferSize.\r | |
244 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 245 | Arguments are pulled from the variable argument list specified by Marker based on the\r |
2075236e | 246 | contents of the format string.\r |
247 | The number of Unicode characters in the produced output buffer is returned not including\r | |
248 | the Null-terminator.\r | |
2075236e | 249 | \r |
9b002aa4 HW |
250 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r |
251 | \r | |
252 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
253 | unmodified and 0 is returned.\r | |
254 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
255 | unmodified and 0 is returned.\r | |
256 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
257 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
258 | buffer is unmodified and 0 is returned.\r | |
2075236e | 259 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
260 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
261 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
262 | \r | |
263 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r | |
2075236e | 264 | \r |
9b002aa4 | 265 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
2075236e | 266 | Unicode string.\r |
267 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
2fc59a00 | 268 | @param FormatString A Null-terminated ASCII format string.\r |
2075236e | 269 | @param Marker BASE_LIST marker for the variable argument list.\r |
9b002aa4 | 270 | \r |
2075236e | 271 | @return The number of Unicode characters in the produced output buffer not including the\r |
272 | Null-terminator.\r | |
273 | \r | |
274 | **/\r | |
275 | UINTN\r | |
276 | EFIAPI\r | |
277 | UnicodeBSPrintAsciiFormat (\r | |
278 | OUT CHAR16 *StartOfBuffer,\r | |
279 | IN UINTN BufferSize,\r | |
280 | IN CONST CHAR8 *FormatString,\r | |
281 | IN BASE_LIST Marker\r | |
282 | )\r | |
283 | {\r | |
284 | ASSERT_UNICODE_BUFFER (StartOfBuffer);\r | |
ebd04fc2 | 285 | return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE, FormatString, gNullVaList, Marker);\r |
e1f414b6 | 286 | }\r |
287 | \r | |
288 | /**\r | |
9b002aa4 | 289 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r |
e1f414b6 | 290 | ASCII format string and variable argument list.\r |
9b002aa4 HW |
291 | \r |
292 | This function is similar as snprintf_s defined in C11.\r | |
293 | \r | |
e1f414b6 | 294 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r |
295 | and BufferSize.\r | |
296 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 297 | Arguments are pulled from the variable argument list based on the contents of the\r |
e1f414b6 | 298 | format string.\r |
299 | The number of Unicode characters in the produced output buffer is returned not including\r | |
300 | the Null-terminator.\r | |
e1f414b6 | 301 | \r |
9b002aa4 HW |
302 | If StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r |
303 | \r | |
304 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
305 | unmodified and 0 is returned.\r | |
306 | If BufferSize > 1 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
307 | unmodified and 0 is returned.\r | |
308 | If PcdMaximumUnicodeStringLength is not zero, and BufferSize >\r | |
309 | (PcdMaximumUnicodeStringLength * sizeof (CHAR16) + 1), then ASSERT(). Also, the output\r | |
310 | buffer is unmodified and 0 is returned.\r | |
e1f414b6 | 311 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
312 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
313 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
314 | \r | |
315 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r | |
e1f414b6 | 316 | \r |
9b002aa4 | 317 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
e1f414b6 | 318 | Unicode string.\r |
319 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
2fc59a00 | 320 | @param FormatString A Null-terminated ASCII format string.\r |
9b002aa4 | 321 | @param ... Variable argument list whose contents are accessed based on the\r |
285010e7 | 322 | format string specified by FormatString.\r |
9b002aa4 | 323 | \r |
e1f414b6 | 324 | @return The number of Unicode characters in the produced output buffer not including the\r |
325 | Null-terminator.\r | |
326 | \r | |
327 | **/\r | |
328 | UINTN\r | |
329 | EFIAPI\r | |
330 | UnicodeSPrintAsciiFormat (\r | |
331 | OUT CHAR16 *StartOfBuffer,\r | |
332 | IN UINTN BufferSize,\r | |
333 | IN CONST CHAR8 *FormatString,\r | |
334 | ...\r | |
335 | )\r | |
336 | {\r | |
337 | VA_LIST Marker;\r | |
3bbe68a3 | 338 | UINTN NumberOfPrinted;\r |
e1f414b6 | 339 | \r |
340 | VA_START (Marker, FormatString);\r | |
3bbe68a3 | 341 | NumberOfPrinted = UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r |
342 | VA_END (Marker);\r | |
343 | return NumberOfPrinted;\r | |
e1f414b6 | 344 | }\r |
345 | \r | |
342fdb6e | 346 | \r |
51f0ceb4 HW |
347 | /**\r |
348 | Converts a decimal value to a Null-terminated Unicode string.\r | |
349 | \r | |
350 | Converts the decimal number specified by Value to a Null-terminated Unicode\r | |
351 | string specified by Buffer containing at most Width characters. No padding of\r | |
352 | spaces is ever performed. If Width is 0 then a width of\r | |
353 | MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than\r | |
354 | Width characters, then only the first Width characters are placed in Buffer.\r | |
355 | Additional conversion parameters are specified in Flags.\r | |
356 | \r | |
357 | The Flags bit LEFT_JUSTIFY is always ignored.\r | |
358 | All conversions are left justified in Buffer.\r | |
359 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
360 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and\r | |
361 | commas are inserted every 3rd digit starting from the right.\r | |
362 | If RADIX_HEX is set in Flags, then the output buffer will be formatted in\r | |
363 | hexadecimal format.\r | |
364 | If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in\r | |
365 | Buffer is a '-'.\r | |
366 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then\r | |
367 | Buffer is padded with '0' characters so the combination of the optional '-'\r | |
368 | sign character, '0' characters, digit characters for Value, and the\r | |
369 | Null-terminator add up to Width characters.\r | |
370 | \r | |
371 | If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
372 | If an error would be returned, then the function will also ASSERT().\r | |
373 | \r | |
374 | @param Buffer The pointer to the output buffer for the produced\r | |
375 | Null-terminated Unicode string.\r | |
376 | @param BufferSize The size of Buffer in bytes, including the\r | |
377 | Null-terminator.\r | |
378 | @param Flags The bitmask of flags that specify left justification,\r | |
379 | zero pad, and commas.\r | |
380 | @param Value The 64-bit signed value to convert to a string.\r | |
381 | @param Width The maximum number of Unicode characters to place in\r | |
382 | Buffer, not including the Null-terminator.\r | |
383 | \r | |
384 | @retval RETURN_SUCCESS The decimal value is converted.\r | |
385 | @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted\r | |
386 | value.\r | |
387 | @retval RETURN_INVALID_PARAMETER If Buffer is NULL.\r | |
388 | If PcdMaximumUnicodeStringLength is not\r | |
389 | zero, and BufferSize is greater than\r | |
390 | (PcdMaximumUnicodeStringLength *\r | |
391 | sizeof (CHAR16) + 1).\r | |
392 | If unsupported bits are set in Flags.\r | |
393 | If both COMMA_TYPE and RADIX_HEX are set in\r | |
394 | Flags.\r | |
395 | If Width >= MAXIMUM_VALUE_CHARACTERS.\r | |
396 | \r | |
397 | **/\r | |
398 | RETURN_STATUS\r | |
399 | EFIAPI\r | |
400 | UnicodeValueToStringS (\r | |
401 | IN OUT CHAR16 *Buffer,\r | |
402 | IN UINTN BufferSize,\r | |
403 | IN UINTN Flags,\r | |
404 | IN INT64 Value,\r | |
405 | IN UINTN Width\r | |
406 | )\r | |
407 | {\r | |
408 | ASSERT_UNICODE_BUFFER(Buffer);\r | |
409 | return BasePrintLibConvertValueToStringS ((CHAR8 *)Buffer, BufferSize, Flags, Value, Width, 2);\r | |
410 | }\r | |
411 | \r | |
e1f414b6 | 412 | /**\r |
413 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
414 | ASCII format string and a VA_LIST argument list.\r | |
9b002aa4 HW |
415 | \r |
416 | This function is similar as vsnprintf_s defined in C11.\r | |
417 | \r | |
e1f414b6 | 418 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r |
419 | and BufferSize.\r | |
420 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 421 | Arguments are pulled from the variable argument list specified by Marker based on\r |
e1f414b6 | 422 | the contents of the format string.\r |
423 | The number of ASCII characters in the produced output buffer is returned not including\r | |
424 | the Null-terminator.\r | |
e1f414b6 | 425 | \r |
9b002aa4 HW |
426 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r |
427 | unmodified and 0 is returned.\r | |
428 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
429 | unmodified and 0 is returned.\r | |
430 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
431 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
432 | is unmodified and 0 is returned.\r | |
e1f414b6 | 433 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
434 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
435 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
436 | \r | |
437 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
e1f414b6 | 438 | \r |
9b002aa4 | 439 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
e1f414b6 | 440 | ASCII string.\r |
441 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
2fc59a00 | 442 | @param FormatString A Null-terminated ASCII format string.\r |
e1f414b6 | 443 | @param Marker VA_LIST marker for the variable argument list.\r |
9b002aa4 | 444 | \r |
e1f414b6 | 445 | @return The number of ASCII characters in the produced output buffer not including the\r |
446 | Null-terminator.\r | |
447 | \r | |
448 | **/\r | |
449 | UINTN\r | |
450 | EFIAPI\r | |
451 | AsciiVSPrint (\r | |
452 | OUT CHAR8 *StartOfBuffer,\r | |
453 | IN UINTN BufferSize,\r | |
454 | IN CONST CHAR8 *FormatString,\r | |
455 | IN VA_LIST Marker\r | |
456 | )\r | |
457 | {\r | |
2075236e | 458 | return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, Marker, NULL);\r |
459 | }\r | |
460 | \r | |
461 | /**\r | |
462 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
463 | ASCII format string and a BASE_LIST argument list.\r | |
9b002aa4 | 464 | \r |
2075236e | 465 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r |
466 | and BufferSize.\r | |
467 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 468 | Arguments are pulled from the variable argument list specified by Marker based on\r |
2075236e | 469 | the contents of the format string.\r |
470 | The number of ASCII characters in the produced output buffer is returned not including\r | |
471 | the Null-terminator.\r | |
2075236e | 472 | \r |
9b002aa4 HW |
473 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r |
474 | unmodified and 0 is returned.\r | |
475 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
476 | unmodified and 0 is returned.\r | |
477 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
478 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
479 | is unmodified and 0 is returned.\r | |
2075236e | 480 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
481 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
482 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
483 | \r | |
484 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
2075236e | 485 | \r |
9b002aa4 | 486 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
2075236e | 487 | ASCII string.\r |
488 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
2fc59a00 | 489 | @param FormatString A Null-terminated ASCII format string.\r |
2075236e | 490 | @param Marker BASE_LIST marker for the variable argument list.\r |
9b002aa4 | 491 | \r |
2075236e | 492 | @return The number of ASCII characters in the produced output buffer not including the\r |
493 | Null-terminator.\r | |
494 | \r | |
495 | **/\r | |
496 | UINTN\r | |
497 | EFIAPI\r | |
498 | AsciiBSPrint (\r | |
499 | OUT CHAR8 *StartOfBuffer,\r | |
500 | IN UINTN BufferSize,\r | |
501 | IN CONST CHAR8 *FormatString,\r | |
502 | IN BASE_LIST Marker\r | |
503 | )\r | |
504 | {\r | |
ebd04fc2 | 505 | return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, gNullVaList, Marker);\r |
e1f414b6 | 506 | }\r |
507 | \r | |
508 | /**\r | |
509 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
510 | ASCII format string and variable argument list.\r | |
9b002aa4 HW |
511 | \r |
512 | This function is similar as snprintf_s defined in C11.\r | |
513 | \r | |
e1f414b6 | 514 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r |
515 | and BufferSize.\r | |
516 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 517 | Arguments are pulled from the variable argument list based on the contents of the\r |
e1f414b6 | 518 | format string.\r |
519 | The number of ASCII characters in the produced output buffer is returned not including\r | |
520 | the Null-terminator.\r | |
e1f414b6 | 521 | \r |
9b002aa4 HW |
522 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r |
523 | unmodified and 0 is returned.\r | |
524 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
525 | unmodified and 0 is returned.\r | |
526 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
527 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
528 | is unmodified and 0 is returned.\r | |
e1f414b6 | 529 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r |
9b002aa4 HW |
530 | PcdMaximumAsciiStringLength Ascii characters not including the Null-terminator, then\r |
531 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r | |
e1f414b6 | 532 | \r |
9b002aa4 HW |
533 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r |
534 | \r | |
535 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r | |
e1f414b6 | 536 | ASCII string.\r |
537 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
2fc59a00 | 538 | @param FormatString A Null-terminated ASCII format string.\r |
9b002aa4 | 539 | @param ... Variable argument list whose contents are accessed based on the\r |
285010e7 | 540 | format string specified by FormatString.\r |
9b002aa4 | 541 | \r |
e1f414b6 | 542 | @return The number of ASCII characters in the produced output buffer not including the\r |
543 | Null-terminator.\r | |
544 | \r | |
545 | **/\r | |
546 | UINTN\r | |
547 | EFIAPI\r | |
548 | AsciiSPrint (\r | |
549 | OUT CHAR8 *StartOfBuffer,\r | |
550 | IN UINTN BufferSize,\r | |
551 | IN CONST CHAR8 *FormatString,\r | |
552 | ...\r | |
553 | )\r | |
554 | {\r | |
555 | VA_LIST Marker;\r | |
3bbe68a3 | 556 | UINTN NumberOfPrinted;\r |
e1f414b6 | 557 | \r |
558 | VA_START (Marker, FormatString);\r | |
3bbe68a3 | 559 | NumberOfPrinted = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r |
560 | VA_END (Marker);\r | |
561 | return NumberOfPrinted;\r | |
e1f414b6 | 562 | }\r |
563 | \r | |
564 | /**\r | |
565 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
eceb3a4c | 566 | Unicode format string and a VA_LIST argument list.\r |
9b002aa4 HW |
567 | \r |
568 | This function is similar as vsnprintf_s defined in C11.\r | |
569 | \r | |
e1f414b6 | 570 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r |
571 | and BufferSize.\r | |
572 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 573 | Arguments are pulled from the variable argument list specified by Marker based on\r |
e1f414b6 | 574 | the contents of the format string.\r |
575 | The number of ASCII characters in the produced output buffer is returned not including\r | |
576 | the Null-terminator.\r | |
e1f414b6 | 577 | \r |
9b002aa4 HW |
578 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r |
579 | \r | |
580 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
581 | unmodified and 0 is returned.\r | |
582 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
583 | unmodified and 0 is returned.\r | |
584 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
585 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
586 | is unmodified and 0 is returned.\r | |
e1f414b6 | 587 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r |
588 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
9b002aa4 HW |
589 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r |
590 | \r | |
591 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
e1f414b6 | 592 | \r |
9b002aa4 | 593 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
e1f414b6 | 594 | ASCII string.\r |
595 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
2fc59a00 | 596 | @param FormatString A Null-terminated Unicode format string.\r |
e1f414b6 | 597 | @param Marker VA_LIST marker for the variable argument list.\r |
9b002aa4 | 598 | \r |
e1f414b6 | 599 | @return The number of ASCII characters in the produced output buffer not including the\r |
600 | Null-terminator.\r | |
601 | \r | |
602 | **/\r | |
603 | UINTN\r | |
604 | EFIAPI\r | |
605 | AsciiVSPrintUnicodeFormat (\r | |
606 | OUT CHAR8 *StartOfBuffer,\r | |
607 | IN UINTN BufferSize,\r | |
608 | IN CONST CHAR16 *FormatString,\r | |
609 | IN VA_LIST Marker\r | |
610 | )\r | |
611 | {\r | |
612 | ASSERT_UNICODE_BUFFER (FormatString);\r | |
2075236e | 613 | return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, Marker, NULL);\r |
614 | }\r | |
615 | \r | |
616 | /**\r | |
617 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
618 | Unicode format string and a BASE_LIST argument list.\r | |
9b002aa4 | 619 | \r |
2075236e | 620 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r |
621 | and BufferSize.\r | |
622 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 623 | Arguments are pulled from the variable argument list specified by Marker based on\r |
2075236e | 624 | the contents of the format string.\r |
625 | The number of ASCII characters in the produced output buffer is returned not including\r | |
626 | the Null-terminator.\r | |
2075236e | 627 | \r |
9b002aa4 HW |
628 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r |
629 | \r | |
630 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
631 | unmodified and 0 is returned.\r | |
632 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
633 | unmodified and 0 is returned.\r | |
634 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
635 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
636 | is unmodified and 0 is returned.\r | |
2075236e | 637 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r |
638 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
9b002aa4 | 639 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r |
2075236e | 640 | \r |
9b002aa4 HW |
641 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r |
642 | \r | |
643 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r | |
2075236e | 644 | ASCII string.\r |
645 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
2fc59a00 | 646 | @param FormatString A Null-terminated Unicode format string.\r |
2075236e | 647 | @param Marker BASE_LIST marker for the variable argument list.\r |
9b002aa4 | 648 | \r |
2075236e | 649 | @return The number of ASCII characters in the produced output buffer not including the\r |
650 | Null-terminator.\r | |
651 | \r | |
652 | **/\r | |
653 | UINTN\r | |
654 | EFIAPI\r | |
655 | AsciiBSPrintUnicodeFormat (\r | |
656 | OUT CHAR8 *StartOfBuffer,\r | |
657 | IN UINTN BufferSize,\r | |
658 | IN CONST CHAR16 *FormatString,\r | |
659 | IN BASE_LIST Marker\r | |
660 | )\r | |
661 | {\r | |
662 | ASSERT_UNICODE_BUFFER (FormatString);\r | |
ebd04fc2 | 663 | return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, gNullVaList, Marker);\r |
e1f414b6 | 664 | }\r |
665 | \r | |
666 | /**\r | |
667 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
eceb3a4c | 668 | Unicode format string and variable argument list.\r |
9b002aa4 HW |
669 | \r |
670 | This function is similar as snprintf_s defined in C11.\r | |
671 | \r | |
e1f414b6 | 672 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r |
673 | and BufferSize.\r | |
674 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
9b002aa4 | 675 | Arguments are pulled from the variable argument list based on the contents of the\r |
e1f414b6 | 676 | format string.\r |
677 | The number of ASCII characters in the produced output buffer is returned not including\r | |
678 | the Null-terminator.\r | |
e1f414b6 | 679 | \r |
9b002aa4 HW |
680 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r |
681 | \r | |
682 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT(). Also, the output buffer is\r | |
683 | unmodified and 0 is returned.\r | |
684 | If BufferSize > 0 and FormatString is NULL, then ASSERT(). Also, the output buffer is\r | |
685 | unmodified and 0 is returned.\r | |
686 | If PcdMaximumAsciiStringLength is not zero, and BufferSize >\r | |
687 | (PcdMaximumAsciiStringLength * sizeof (CHAR8)), then ASSERT(). Also, the output buffer\r | |
688 | is unmodified and 0 is returned.\r | |
e1f414b6 | 689 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r |
690 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
9b002aa4 HW |
691 | ASSERT(). Also, the output buffer is unmodified and 0 is returned.\r |
692 | \r | |
693 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
e1f414b6 | 694 | \r |
9b002aa4 | 695 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated\r |
e1f414b6 | 696 | ASCII string.\r |
697 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
2fc59a00 | 698 | @param FormatString A Null-terminated Unicode format string.\r |
9b002aa4 | 699 | @param ... Variable argument list whose contents are accessed based on the\r |
285010e7 | 700 | format string specified by FormatString.\r |
9b002aa4 | 701 | \r |
e1f414b6 | 702 | @return The number of ASCII characters in the produced output buffer not including the\r |
703 | Null-terminator.\r | |
704 | \r | |
705 | **/\r | |
706 | UINTN\r | |
707 | EFIAPI\r | |
708 | AsciiSPrintUnicodeFormat (\r | |
709 | OUT CHAR8 *StartOfBuffer,\r | |
710 | IN UINTN BufferSize,\r | |
711 | IN CONST CHAR16 *FormatString,\r | |
712 | ...\r | |
713 | )\r | |
714 | {\r | |
715 | VA_LIST Marker;\r | |
3bbe68a3 | 716 | UINTN NumberOfPrinted;\r |
e1f414b6 | 717 | \r |
718 | VA_START (Marker, FormatString);\r | |
3bbe68a3 | 719 | NumberOfPrinted = AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r |
720 | VA_END (Marker);\r | |
721 | return NumberOfPrinted;\r | |
e1f414b6 | 722 | }\r |
723 | \r | |
51f0ceb4 HW |
724 | /**\r |
725 | Converts a decimal value to a Null-terminated Ascii string.\r | |
726 | \r | |
727 | Converts the decimal number specified by Value to a Null-terminated Ascii\r | |
728 | string specified by Buffer containing at most Width characters. No padding of\r | |
729 | spaces is ever performed. If Width is 0 then a width of\r | |
730 | MAXIMUM_VALUE_CHARACTERS is assumed. If the conversion contains more than\r | |
731 | Width characters, then only the first Width characters are placed in Buffer.\r | |
732 | Additional conversion parameters are specified in Flags.\r | |
733 | \r | |
734 | The Flags bit LEFT_JUSTIFY is always ignored.\r | |
735 | All conversions are left justified in Buffer.\r | |
736 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
737 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and\r | |
738 | commas are inserted every 3rd digit starting from the right.\r | |
739 | If RADIX_HEX is set in Flags, then the output buffer will be formatted in\r | |
740 | hexadecimal format.\r | |
741 | If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in\r | |
742 | Buffer is a '-'.\r | |
743 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then\r | |
744 | Buffer is padded with '0' characters so the combination of the optional '-'\r | |
745 | sign character, '0' characters, digit characters for Value, and the\r | |
746 | Null-terminator add up to Width characters.\r | |
747 | \r | |
5923ef92 | 748 | If an error would be returned, then the function will ASSERT().\r |
51f0ceb4 HW |
749 | \r |
750 | @param Buffer The pointer to the output buffer for the produced\r | |
751 | Null-terminated Ascii string.\r | |
752 | @param BufferSize The size of Buffer in bytes, including the\r | |
753 | Null-terminator.\r | |
754 | @param Flags The bitmask of flags that specify left justification,\r | |
755 | zero pad, and commas.\r | |
756 | @param Value The 64-bit signed value to convert to a string.\r | |
757 | @param Width The maximum number of Ascii characters to place in\r | |
758 | Buffer, not including the Null-terminator.\r | |
759 | \r | |
760 | @retval RETURN_SUCCESS The decimal value is converted.\r | |
761 | @retval RETURN_BUFFER_TOO_SMALL If BufferSize cannot hold the converted\r | |
762 | value.\r | |
763 | @retval RETURN_INVALID_PARAMETER If Buffer is NULL.\r | |
764 | If PcdMaximumAsciiStringLength is not\r | |
765 | zero, and BufferSize is greater than\r | |
766 | PcdMaximumAsciiStringLength.\r | |
767 | If unsupported bits are set in Flags.\r | |
768 | If both COMMA_TYPE and RADIX_HEX are set in\r | |
769 | Flags.\r | |
770 | If Width >= MAXIMUM_VALUE_CHARACTERS.\r | |
771 | \r | |
772 | **/\r | |
773 | RETURN_STATUS\r | |
774 | EFIAPI\r | |
775 | AsciiValueToStringS (\r | |
776 | IN OUT CHAR8 *Buffer,\r | |
777 | IN UINTN BufferSize,\r | |
778 | IN UINTN Flags,\r | |
779 | IN INT64 Value,\r | |
780 | IN UINTN Width\r | |
781 | )\r | |
782 | {\r | |
783 | return BasePrintLibConvertValueToStringS (Buffer, BufferSize, Flags, Value, Width, 1);\r | |
784 | }\r | |
785 | \r | |
f405c067 | 786 | /**\r |
9095d37b | 787 | Returns the number of characters that would be produced by if the formatted\r |
f405c067 | 788 | output were produced not including the Null-terminator.\r |
789 | \r | |
f405c067 | 790 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r |
791 | \r | |
9b002aa4 HW |
792 | If FormatString is NULL, then ASSERT() and 0 is returned.\r |
793 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more\r | |
794 | than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
795 | Null-terminator, then ASSERT() and 0 is returned.\r | |
796 | \r | |
f405c067 | 797 | @param[in] FormatString A Null-terminated Unicode format string.\r |
798 | @param[in] Marker VA_LIST marker for the variable argument list.\r | |
799 | \r | |
9095d37b | 800 | @return The number of characters that would be produced, not including the\r |
f405c067 | 801 | Null-terminator.\r |
802 | **/\r | |
803 | UINTN\r | |
804 | EFIAPI\r | |
805 | SPrintLength (\r | |
806 | IN CONST CHAR16 *FormatString,\r | |
807 | IN VA_LIST Marker\r | |
808 | )\r | |
809 | {\r | |
f405c067 | 810 | ASSERT_UNICODE_BUFFER (FormatString);\r |
811 | return BasePrintLibSPrintMarker (NULL, 0, FORMAT_UNICODE | OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL);\r | |
812 | }\r | |
813 | \r | |
814 | /**\r | |
9095d37b | 815 | Returns the number of characters that would be produced by if the formatted\r |
f405c067 | 816 | output were produced not including the Null-terminator.\r |
817 | \r | |
9b002aa4 HW |
818 | If FormatString is NULL, then ASSERT() and 0 is returned.\r |
819 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more\r | |
820 | than PcdMaximumAsciiStringLength Ascii characters not including the\r | |
821 | Null-terminator, then ASSERT() and 0 is returned.\r | |
f405c067 | 822 | \r |
823 | @param[in] FormatString A Null-terminated ASCII format string.\r | |
824 | @param[in] Marker VA_LIST marker for the variable argument list.\r | |
825 | \r | |
9095d37b | 826 | @return The number of characters that would be produced, not including the\r |
f405c067 | 827 | Null-terminator.\r |
828 | **/\r | |
829 | UINTN\r | |
830 | EFIAPI\r | |
831 | SPrintLengthAsciiFormat (\r | |
832 | IN CONST CHAR8 *FormatString,\r | |
833 | IN VA_LIST Marker\r | |
834 | )\r | |
835 | {\r | |
f405c067 | 836 | return BasePrintLibSPrintMarker (NULL, 0, OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL);\r |
837 | }\r |