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