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