]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BasePrintLib/PrintLib.c
Add Missing invocations to VA_END() for VA_START().
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / BasePrintLib / PrintLib.c
CommitLineData
3eb9473e 1/*++\r
2\r
3bbe68a3 3Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
2c7e5c2f 4This program and the accompanying materials \r
3eb9473e 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12\r
13Module Name:\r
14\r
15 PrintLib.c\r
16 \r
17Abstract: \r
18\r
19 Print Library.\r
20\r
21--*/\r
22\r
23#include "PrintLibInternal.h"\r
24\r
25#define WARNING_STATUS_NUMBER 4\r
26#define ERROR_STATUS_NUMBER 24\r
27#define ASSERT_UNICODE_BUFFER(Buffer) ASSERT ((((UINTN) (Buffer)) & 0x01) == 0)\r
28\r
29GLOBAL_REMOVE_IF_UNREFERENCED CONST CHAR8 *StatusString [] = {\r
30 "Success", // RETURN_SUCCESS = 0\r
31 "Warning Unknown Glyph", // RETURN_WARN_UNKNOWN_GLYPH = 1\r
32 "Warning Delete Failure", // RETURN_WARN_DELETE_FAILURE = 2\r
33 "Warning Write Failure", // RETURN_WARN_WRITE_FAILURE = 3\r
34 "Warning Buffer Too Small", // RETURN_WARN_BUFFER_TOO_SMALL = 4\r
35 "Load Error", // RETURN_LOAD_ERROR = 1 | MAX_BIT\r
36 "Invalid Parameter", // RETURN_INVALID_PARAMETER = 2 | MAX_BIT\r
37 "Unsupported", // RETURN_UNSUPPORTED = 3 | MAX_BIT\r
38 "Bad Buffer Size", // RETURN_BAD_BUFFER_SIZE = 4 | MAX_BIT\r
39 "Buffer Too Small", // RETURN_BUFFER_TOO_SMALL, = 5 | MAX_BIT\r
40 "Not Ready", // RETURN_NOT_READY = 6 | MAX_BIT\r
41 "Device Error", // RETURN_DEVICE_ERROR = 7 | MAX_BIT\r
42 "Write Protected", // RETURN_WRITE_PROTECTED = 8 | MAX_BIT\r
43 "Out of Resources", // RETURN_OUT_OF_RESOURCES = 9 | MAX_BIT\r
44 "Volume Corrupt", // RETURN_VOLUME_CORRUPTED = 10 | MAX_BIT\r
45 "Volume Full", // RETURN_VOLUME_FULL = 11 | MAX_BIT\r
46 "No Media", // RETURN_NO_MEDIA = 12 | MAX_BIT\r
47 "Media changed", // RETURN_MEDIA_CHANGED = 13 | MAX_BIT\r
48 "Not Found", // RETURN_NOT_FOUND = 14 | MAX_BIT\r
49 "Access Denied", // RETURN_ACCESS_DENIED = 15 | MAX_BIT\r
50 "No Response", // RETURN_NO_RESPONSE = 16 | MAX_BIT\r
51 "No mapping", // RETURN_NO_MAPPING = 17 | MAX_BIT\r
52 "Time out", // RETURN_TIMEOUT = 18 | MAX_BIT\r
53 "Not started", // RETURN_NOT_STARTED = 19 | MAX_BIT\r
54 "Already started", // RETURN_ALREADY_STARTED = 20 | MAX_BIT\r
55 "Aborted", // RETURN_ABORTED = 21 | MAX_BIT\r
56 "ICMP Error", // RETURN_ICMP_ERROR = 22 | MAX_BIT\r
57 "TFTP Error", // RETURN_TFTP_ERROR = 23 | MAX_BIT\r
58 "Protocol Error" // RETURN_PROTOCOL_ERROR = 24 | MAX_BIT\r
59};\r
60\r
61/**\r
62 Worker function that produces a Null-terminated string in an output buffer \r
63 based on a Null-terminated format string and a VA_LIST argument list.\r
64\r
65 VSPrint function to process format and place the results in Buffer. Since a \r
66 VA_LIST is used this rountine allows the nesting of Vararg routines. Thus \r
67 this is the main print working routine.\r
68\r
69 @param Buffer Character buffer to print the results of the parsing\r
70 of Format into.\r
71 @param BufferSize Maximum number of characters to put into buffer.\r
72 @param Flags Intial flags value.\r
73 Can only have FORMAT_UNICODE and OUTPUT_UNICODE set.\r
74 @param Format Null-terminated format string.\r
75 @param Marker Vararg list consumed by processing Format.\r
76\r
77 @return Number of characters printed not including the Null-terminator.\r
78\r
79**/\r
80UINTN\r
81BasePrintLibVSPrint (\r
82 OUT CHAR8 *Buffer,\r
83 IN UINTN BufferSize,\r
84 IN UINTN Flags,\r
85 IN CONST CHAR8 *Format,\r
86 IN VA_LIST Marker\r
87 )\r
88{\r
89 CHAR8 *OriginalBuffer;\r
90 CHAR8 *EndBuffer;\r
91 CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS];\r
92 UINTN BytesPerOutputCharacter;\r
93 UINTN BytesPerFormatCharacter;\r
94 UINTN FormatMask;\r
95 UINTN FormatCharacter;\r
96 UINTN Width;\r
97 UINTN Precision;\r
98 INT64 Value;\r
99 CONST CHAR8 *ArgumentString;\r
100 UINTN Character;\r
101 GUID *TmpGuid;\r
102 TIME *TmpTime;\r
103 UINTN Count;\r
104 UINTN ArgumentMask;\r
105 INTN BytesPerArgumentCharacter;\r
106 UINTN ArgumentCharacter;\r
107 BOOLEAN Done;\r
108 UINTN Index;\r
109 CHAR8 Prefix;\r
110 BOOLEAN ZeroPad;\r
111 BOOLEAN Comma;\r
112 UINTN Digits;\r
113 UINTN Radix;\r
114 RETURN_STATUS Status;\r
115\r
116 if (BufferSize == 0) {\r
117 return 0;\r
118 }\r
119 ASSERT (Buffer != NULL);\r
120\r
121 if ((Flags & OUTPUT_UNICODE) != 0) {\r
122 BytesPerOutputCharacter = 2;\r
123 } else {\r
124 BytesPerOutputCharacter = 1;\r
125 }\r
126\r
127 //\r
128 // Reserve space for the Null terminator.\r
129 //\r
130 BufferSize--;\r
131 OriginalBuffer = Buffer;\r
132 //\r
133 // Set the tag for the end of the input Buffer.\r
134 //\r
135 EndBuffer = Buffer + BufferSize * BytesPerOutputCharacter;\r
136\r
137 if ((Flags & FORMAT_UNICODE) != 0) {\r
138 //\r
139 // Make sure format string cannot contain more than PcdMaximumUnicodeStringLength\r
140 // Unicode characters if PcdMaximumUnicodeStringLength is not zero. \r
141 //\r
142 ASSERT (StrSize ((CHAR16 *) Format) != 0);\r
143 BytesPerFormatCharacter = 2;\r
144 FormatMask = 0xffff;\r
145 } else {\r
146 //\r
147 // Make sure format string cannot contain more than PcdMaximumAsciiStringLength\r
148 // Ascii characters if PcdMaximumAsciiStringLength is not zero. \r
149 //\r
150 ASSERT (AsciiStrSize (Format) != 0);\r
151 BytesPerFormatCharacter = 1;\r
152 FormatMask = 0xff;\r
153 }\r
154\r
155\r
156\r
157 //\r
158 // Get the first character from the format string\r
159 //\r
160 FormatCharacter = (*Format | (*(Format + 1) << 8)) & FormatMask;\r
161\r
162 //\r
163 // Loop until the end of the format string is reached or the output buffer is full\r
164 //\r
165 while (FormatCharacter != 0 && Buffer < EndBuffer) {\r
166 //\r
167 // Clear all the flag bits except those that may have been passed in\r
168 //\r
169 Flags &= (OUTPUT_UNICODE | FORMAT_UNICODE);\r
170\r
171 //\r
172 // Set the default width to zero, and the default precision to 1\r
173 //\r
174 Width = 0;\r
175 Precision = 1;\r
176 Prefix = 0;\r
177 Comma = FALSE;\r
178 ZeroPad = FALSE;\r
179 Count = 0;\r
180 Digits = 0;\r
181\r
182 switch (FormatCharacter) {\r
183 case '%':\r
184 //\r
185 // Parse Flags and Width\r
186 //\r
187 for (Done = FALSE; !Done; ) {\r
188 Format += BytesPerFormatCharacter;\r
189 FormatCharacter = (*Format | (*(Format + 1) << 8)) & FormatMask;\r
190 switch (FormatCharacter) {\r
191 case '.': \r
192 Flags |= PRECISION; \r
193 break;\r
194 case '-': \r
195 Flags |= LEFT_JUSTIFY; \r
196 break;\r
197 case '+': \r
198 Flags |= PREFIX_SIGN; \r
199 break;\r
200 case ' ': \r
201 Flags |= PREFIX_BLANK; \r
202 break;\r
203 case ',': \r
204 Flags |= COMMA_TYPE; \r
205 break;\r
206 case 'L':\r
207 case 'l': \r
208 Flags |= LONG_TYPE; \r
209 break;\r
210 case '*':\r
211 if ((Flags & PRECISION) == 0) {\r
212 Flags |= PAD_TO_WIDTH;\r
213 Width = VA_ARG (Marker, UINTN);\r
214 } else {\r
215 Precision = VA_ARG (Marker, UINTN);\r
216 }\r
217 break;\r
218 case '0':\r
219 if ((Flags & PRECISION) == 0) {\r
220 Flags |= PREFIX_ZERO;\r
221 }\r
222 case '1':\r
223 case '2':\r
224 case '3':\r
225 case '4':\r
226 case '5':\r
227 case '6':\r
228 case '7':\r
229 case '8':\r
230 case '9':\r
231 for (Count = 0; ((FormatCharacter >= '0') && (FormatCharacter <= '9')); ){\r
232 Count = (Count * 10) + FormatCharacter - '0';\r
233 Format += BytesPerFormatCharacter;\r
234 FormatCharacter = (*Format | (*(Format + 1) << 8)) & FormatMask;\r
235 }\r
236 Format -= BytesPerFormatCharacter;\r
237 if ((Flags & PRECISION) == 0) {\r
238 Flags |= PAD_TO_WIDTH;\r
239 Width = Count;\r
240 } else {\r
241 Precision = Count;\r
242 }\r
243 break;\r
244 \r
245 case '\0':\r
246 //\r
247 // Make no output if Format string terminates unexpectedly when\r
248 // looking up for flag, width, precision and type. \r
249 //\r
250 Format -= BytesPerFormatCharacter;\r
251 Precision = 0;\r
252 //\r
253 // break skipped on purpose.\r
254 //\r
255 default:\r
256 Done = TRUE;\r
257 break;\r
258 }\r
259 } \r
260\r
261 //\r
262 // Handle each argument type\r
263 //\r
264 switch (FormatCharacter) {\r
265 case 'p':\r
266 //\r
267 // Flag space, +, 0, L & l are invalid for type p.\r
268 //\r
269 Flags &= ~(PREFIX_BLANK | PREFIX_SIGN | PREFIX_ZERO | LONG_TYPE);\r
270 if (sizeof (VOID *) > 4) {\r
271 Flags |= LONG_TYPE;\r
272 }\r
273 case 'X':\r
274 Flags |= PREFIX_ZERO;\r
275 //\r
276 // break skipped on purpose\r
277 //\r
278 case 'x':\r
279 Flags |= RADIX_HEX;\r
280 //\r
281 // break skipped on purpose\r
282 //\r
283 case 'd':\r
284 if ((Flags & LONG_TYPE) == 0) {\r
285 Value = (VA_ARG (Marker, int));\r
286 } else {\r
287 Value = VA_ARG (Marker, INT64);\r
288 }\r
289 if ((Flags & PREFIX_BLANK) != 0) {\r
290 Prefix = ' ';\r
291 }\r
292 if ((Flags & PREFIX_SIGN) != 0) {\r
293 Prefix = '+';\r
294 }\r
295 if ((Flags & COMMA_TYPE) != 0) {\r
296 Comma = TRUE;\r
297 }\r
298 if ((Flags & RADIX_HEX) == 0) {\r
299 Radix = 10;\r
300 if (Comma) {\r
301 Flags &= (~PREFIX_ZERO);\r
302 Precision = 1;\r
303 }\r
304 if (Value < 0) {\r
305 Flags |= PREFIX_SIGN;\r
306 Prefix = '-';\r
307 Value = -Value;\r
308 }\r
309 } else {\r
310 Radix = 16;\r
311 Comma = FALSE;\r
312 if ((Flags & LONG_TYPE) == 0 && Value < 0) {\r
313 Value = (unsigned int)Value;\r
314 }\r
315 }\r
316 //\r
317 // Convert Value to a reversed string\r
318 //\r
319 Count = BasePrintLibValueToString (ValueBuffer, Value, Radix);\r
320 if (Value == 0 && Precision == 0) {\r
321 Count = 0;\r
322 }\r
323 ArgumentString = (CHAR8 *)ValueBuffer + Count;\r
324 \r
325 Digits = Count % 3;\r
326 if (Digits != 0) {\r
327 Digits = 3 - Digits;\r
328 }\r
329 if (Comma && Count != 0) {\r
330 Count += ((Count - 1) / 3);\r
331 }\r
332 if (Prefix != 0) {\r
333 Count++;\r
334 Precision++;\r
335 }\r
336 Flags |= ARGUMENT_REVERSED;\r
337 ZeroPad = TRUE;\r
338 if ((Flags & PREFIX_ZERO) != 0) {\r
339 if ((Flags & LEFT_JUSTIFY) == 0) {\r
340 if ((Flags & PAD_TO_WIDTH) != 0) {\r
341 if ((Flags & PRECISION) == 0) {\r
342 Precision = Width;\r
343 }\r
344 }\r
345 }\r
346 }\r
347 break;\r
348\r
349 case 's':\r
350 case 'S':\r
351 Flags |= ARGUMENT_UNICODE;\r
352 //\r
353 // break skipped on purpose\r
354 //\r
355 case 'a':\r
356 ArgumentString = (CHAR8 *)VA_ARG (Marker, CHAR8 *);\r
357 if (ArgumentString == NULL) {\r
358 Flags &= (~ARGUMENT_UNICODE);\r
359 ArgumentString = "<null string>";\r
360 }\r
361 break;\r
362\r
363 case 'c':\r
364 Character = VA_ARG (Marker, UINTN) & 0xffff;\r
365 ArgumentString = (CHAR8 *)&Character;\r
366 Flags |= ARGUMENT_UNICODE;\r
367 break;\r
368\r
369 case 'g':\r
370 TmpGuid = VA_ARG (Marker, GUID *);\r
371 if (TmpGuid == NULL) {\r
372 ArgumentString = "<null guid>";\r
373 } else {\r
374 BasePrintLibSPrint (\r
375 ValueBuffer,\r
376 MAXIMUM_VALUE_CHARACTERS, \r
377 0,\r
378 "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",\r
379 TmpGuid->Data1,\r
380 TmpGuid->Data2,\r
381 TmpGuid->Data3,\r
382 TmpGuid->Data4[0],\r
383 TmpGuid->Data4[1],\r
384 TmpGuid->Data4[2],\r
385 TmpGuid->Data4[3],\r
386 TmpGuid->Data4[4],\r
387 TmpGuid->Data4[5],\r
388 TmpGuid->Data4[6],\r
389 TmpGuid->Data4[7]\r
390 );\r
391 ArgumentString = ValueBuffer;\r
392 }\r
393 break;\r
394\r
395 case 't':\r
396 TmpTime = VA_ARG (Marker, TIME *); \r
397 if (TmpTime == NULL) {\r
398 ArgumentString = "<null time>";\r
399 } else {\r
400 BasePrintLibSPrint (\r
401 ValueBuffer,\r
402 MAXIMUM_VALUE_CHARACTERS,\r
403 0,\r
404 "%02d/%02d/%04d %02d:%02d",\r
405 TmpTime->Month,\r
406 TmpTime->Day,\r
407 TmpTime->Year,\r
408 TmpTime->Hour,\r
409 TmpTime->Minute\r
410 );\r
411 ArgumentString = ValueBuffer;\r
412 }\r
413 break;\r
414\r
415 case 'r':\r
416 Status = VA_ARG (Marker, RETURN_STATUS);\r
417 ArgumentString = ValueBuffer;\r
418 if (RETURN_ERROR (Status)) {\r
419 //\r
420 // Clear error bit\r
421 //\r
422 Index = Status & ~MAX_BIT;\r
423 if (Index > 0 && Index <= ERROR_STATUS_NUMBER) {\r
424 ArgumentString = StatusString [Index + WARNING_STATUS_NUMBER];\r
425 }\r
426 } else {\r
52fb4d3d 427 Index = (UINTN) Status;\r
3eb9473e 428 if (Index <= WARNING_STATUS_NUMBER) {\r
429 ArgumentString = StatusString [Index];\r
430 }\r
431 }\r
432 if (ArgumentString == ValueBuffer) {\r
433 BasePrintLibSPrint ((CHAR8 *) ValueBuffer, MAXIMUM_VALUE_CHARACTERS, 0, "%08X", Status);\r
434 }\r
435 break;\r
436\r
437 case '\n':\r
438 ArgumentString = "\n\r";\r
439 break;\r
440\r
441 case '%':\r
442 default:\r
443 //\r
444 // if the type is '%' or unknown, then print it to the screen\r
445 //\r
446 ArgumentString = (CHAR8 *)&FormatCharacter;\r
447 Flags |= ARGUMENT_UNICODE;\r
448 break;\r
449 }\r
450 break;\r
451 \r
452 case '\n':\r
453 ArgumentString = "\n\r";\r
454 break;\r
455\r
456 default:\r
457 ArgumentString = (CHAR8 *)&FormatCharacter;\r
458 Flags |= ARGUMENT_UNICODE;\r
459 break;\r
460 }\r
461\r
462 //\r
463 // Retrieve the ArgumentString attriubutes\r
464 //\r
465 if ((Flags & ARGUMENT_UNICODE) != 0) {\r
466 ArgumentMask = 0xffff;\r
467 BytesPerArgumentCharacter = 2;\r
468 } else {\r
469 ArgumentMask = 0xff;\r
470 BytesPerArgumentCharacter = 1;\r
471 }\r
472 if ((Flags & ARGUMENT_REVERSED) != 0) {\r
473 BytesPerArgumentCharacter = -BytesPerArgumentCharacter;\r
474 } else {\r
475 //\r
476 // Compute the number of characters in ArgumentString and store it in Count\r
477 // ArgumentString is either null-terminated, or it contains Precision characters\r
478 //\r
479 for (Count = 0; Count < Precision || ((Flags & PRECISION) == 0); Count++) {\r
480 ArgumentCharacter = ((ArgumentString[Count * BytesPerArgumentCharacter] & 0xff) | ((ArgumentString[Count * BytesPerArgumentCharacter + 1]) << 8)) & ArgumentMask;\r
481 if (ArgumentCharacter == 0) {\r
482 break;\r
483 }\r
484 }\r
485 }\r
486\r
487 if (Precision < Count) {\r
488 Precision = Count;\r
489 }\r
490\r
491 //\r
492 // Pad before the string\r
493 //\r
494 if ((Flags & (PAD_TO_WIDTH | LEFT_JUSTIFY)) == (PAD_TO_WIDTH)) {\r
495 Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Width - Precision, ' ', BytesPerOutputCharacter);\r
496 }\r
497\r
498 if (ZeroPad) {\r
499 if (Prefix != 0) {\r
500 Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, Prefix, BytesPerOutputCharacter);\r
501 }\r
502 Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Precision - Count, '0', BytesPerOutputCharacter);\r
503 } else {\r
504 Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Precision - Count, ' ', BytesPerOutputCharacter);\r
505 if (Prefix != 0) {\r
506 Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, Prefix, BytesPerOutputCharacter);\r
507 }\r
508 }\r
509\r
510 //\r
511 // Output the Prefix character if it is present\r
512 //\r
513 Index = 0;\r
514 if (Prefix != 0) {\r
515 Index++;\r
516 }\r
517\r
518 //\r
519 // Copy the string into the output buffer performing the required type conversions\r
520 //\r
521 while (Index < Count) {\r
522 ArgumentCharacter = ((*ArgumentString & 0xff) | (*(ArgumentString + 1) << 8)) & ArgumentMask;\r
523\r
524 Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ArgumentCharacter, BytesPerOutputCharacter);\r
525 ArgumentString += BytesPerArgumentCharacter;\r
526 Index++;\r
527 if (Comma) {\r
528 Digits++;\r
529 if (Digits == 3) {\r
530 Digits = 0;\r
531 Index++;\r
532 if (Index < Count) {\r
533 Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, 1, ',', BytesPerOutputCharacter);\r
534 }\r
535 }\r
536 }\r
537 }\r
538\r
539 //\r
540 // Pad after the string\r
541 //\r
542 if ((Flags & (PAD_TO_WIDTH | LEFT_JUSTIFY)) == (PAD_TO_WIDTH | LEFT_JUSTIFY)) {\r
543 Buffer = BasePrintLibFillBuffer (Buffer, EndBuffer, Width - Precision, ' ', BytesPerOutputCharacter);\r
544 }\r
545\r
546 //\r
547 // Get the next character from the format string\r
548 //\r
549 Format += BytesPerFormatCharacter;\r
550\r
551 //\r
552 // Get the next character from the format string\r
553 //\r
554 FormatCharacter = (*Format | (*(Format + 1) << 8)) & FormatMask;\r
555 }\r
556\r
557 //\r
558 // Null terminate the Unicode or ASCII string\r
559 //\r
560 BasePrintLibFillBuffer (Buffer, EndBuffer + BytesPerOutputCharacter, 1, 0, BytesPerOutputCharacter);\r
561 //\r
562 // Make sure output buffer cannot contain more than PcdMaximumUnicodeStringLength\r
563 // Unicode characters if PcdMaximumUnicodeStringLength is not zero. \r
564 //\r
565 ASSERT ((((Flags & OUTPUT_UNICODE) == 0)) || (StrSize ((CHAR16 *) OriginalBuffer) != 0));\r
566 //\r
567 // Make sure output buffer cannot contain more than PcdMaximumAsciiStringLength\r
568 // ASCII characters if PcdMaximumAsciiStringLength is not zero. \r
569 //\r
570 ASSERT ((((Flags & OUTPUT_UNICODE) != 0)) || (AsciiStrSize (OriginalBuffer) != 0));\r
571\r
572 return ((Buffer - OriginalBuffer) / BytesPerOutputCharacter);\r
573}\r
574\r
575/**\r
576 Worker function that produces a Null-terminated string in an output buffer \r
577 based on a Null-terminated format string and variable argument list.\r
578\r
579 VSPrint function to process format and place the results in Buffer. Since a \r
580 VA_LIST is used this rountine allows the nesting of Vararg routines. Thus \r
581 this is the main print working routine.\r
582\r
583 @param Buffer Character buffer to print the results of the parsing\r
584 of Format into.\r
585 @param BufferSize Maximum number of characters to put into buffer.\r
586 Zero means no limit.\r
587 @param Flags Intial flags value.\r
588 Can only have FORMAT_UNICODE and OUTPUT_UNICODE set\r
589 @param FormatString Null-terminated format string.\r
590\r
591 @return Number of characters printed not including the Null-terminator.\r
592\r
593**/\r
594UINTN\r
595BasePrintLibSPrint (\r
596 OUT CHAR8 *StartOfBuffer,\r
597 IN UINTN BufferSize,\r
598 IN UINTN Flags,\r
599 IN CONST CHAR8 *FormatString,\r
600 ...\r
601 )\r
602{\r
603 VA_LIST Marker;\r
3bbe68a3 604 UINTN NumberOfPrinted;\r
3eb9473e 605\r
606 VA_START (Marker, FormatString);\r
3bbe68a3 607 NumberOfPrinted = BasePrintLibVSPrint (StartOfBuffer, BufferSize, Flags, FormatString, Marker);\r
608 VA_END (Marker);\r
609 return NumberOfPrinted;\r
3eb9473e 610}\r
611\r
612/**\r
613 Produces a Null-terminated Unicode string in an output buffer based on \r
614 a Null-terminated Unicode format string and a VA_LIST argument list\r
615 \r
616 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
617 and BufferSize. \r
618 The Unicode string is produced by parsing the format string specified by FormatString. \r
619 Arguments are pulled from the variable argument list specified by Marker based on the \r
620 contents of the format string. \r
621 The number of Unicode characters in the produced output buffer is returned not including\r
622 the Null-terminator.\r
623 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
624\r
625 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
626 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
627 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
628 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
629 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r
630 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
631 ASSERT().\r
632 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
633 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
634 Null-terminator, then ASSERT().\r
635\r
636 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
637 Unicode string.\r
638 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
639 @param FormatString Null-terminated Unicode format string.\r
640 @param Marker VA_LIST marker for the variable argument list.\r
641 \r
642 @return The number of Unicode characters in the produced output buffer not including the\r
643 Null-terminator.\r
644\r
645**/\r
646UINTN\r
647EFIAPI\r
648UnicodeVSPrint (\r
649 OUT CHAR16 *StartOfBuffer,\r
650 IN UINTN BufferSize,\r
651 IN CONST CHAR16 *FormatString,\r
652 IN VA_LIST Marker\r
653 )\r
654{\r
655 ASSERT_UNICODE_BUFFER(StartOfBuffer);\r
656 ASSERT_UNICODE_BUFFER(FormatString);\r
657 return BasePrintLibVSPrint ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, Marker);\r
658}\r
659\r
660/**\r
661 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r
662 Unicode format string and variable argument list.\r
663 \r
664 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
665 and BufferSize.\r
666 The Unicode string is produced by parsing the format string specified by FormatString.\r
667 Arguments are pulled from the variable argument list based on the contents of the format string.\r
668 The number of Unicode characters in the produced output buffer is returned not including\r
669 the Null-terminator.\r
670 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
671\r
672 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
673 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
674 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
675 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
676 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r
677 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
678 ASSERT().\r
679 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
680 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
681 Null-terminator, then ASSERT().\r
682\r
683 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
684 Unicode string.\r
685 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
686 @param FormatString Null-terminated Unicode format string.\r
687 \r
688 @return The number of Unicode characters in the produced output buffer not including the\r
689 Null-terminator.\r
690\r
691**/\r
692UINTN\r
693EFIAPI\r
694UnicodeSPrint (\r
695 OUT CHAR16 *StartOfBuffer,\r
696 IN UINTN BufferSize,\r
697 IN CONST CHAR16 *FormatString,\r
698 ...\r
699 )\r
700{\r
701 VA_LIST Marker;\r
3bbe68a3 702 UINTN NumberOfPrinted;\r
3eb9473e 703\r
704 VA_START (Marker, FormatString);\r
3bbe68a3 705 NumberOfPrinted = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r
706 VA_END (Marker);\r
707 return NumberOfPrinted;\r
3eb9473e 708}\r
709\r
710/**\r
711 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r
712 ASCII format string and a VA_LIST argument list\r
713 \r
714 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
715 and BufferSize.\r
716 The Unicode string is produced by parsing the format string specified by FormatString.\r
717 Arguments are pulled from the variable argument list specified by Marker based on the \r
718 contents of the format string.\r
719 The number of Unicode characters in the produced output buffer is returned not including\r
720 the Null-terminator.\r
721 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
722\r
723 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
724 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
725 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
726 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
727 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
728 ASSERT().\r
729 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
730 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
731 Null-terminator, then ASSERT().\r
732\r
733 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
734 Unicode string.\r
735 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
736 @param FormatString Null-terminated Unicode format string.\r
737 @param Marker VA_LIST marker for the variable argument list.\r
738 \r
739 @return The number of Unicode characters in the produced output buffer not including the\r
740 Null-terminator.\r
741\r
742**/\r
743UINTN\r
744EFIAPI\r
745UnicodeVSPrintAsciiFormat (\r
746 OUT CHAR16 *StartOfBuffer,\r
747 IN UINTN BufferSize,\r
748 IN CONST CHAR8 *FormatString,\r
749 IN VA_LIST Marker\r
750 )\r
751{\r
752 ASSERT_UNICODE_BUFFER(StartOfBuffer);\r
753 return BasePrintLibVSPrint ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE,FormatString, Marker);\r
754}\r
755\r
756/**\r
757 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r
758 ASCII format string and variable argument list.\r
759 \r
760 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
761 and BufferSize.\r
762 The Unicode string is produced by parsing the format string specified by FormatString.\r
763 Arguments are pulled from the variable argument list based on the contents of the \r
764 format string.\r
765 The number of Unicode characters in the produced output buffer is returned not including\r
766 the Null-terminator.\r
767 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
768\r
769 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
770 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
771 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
772 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
773 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
774 ASSERT().\r
775 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
776 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
777 Null-terminator, then ASSERT().\r
778\r
779 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
780 Unicode string.\r
781 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
782 @param FormatString Null-terminated Unicode format string.\r
783 \r
784 @return The number of Unicode characters in the produced output buffer not including the\r
785 Null-terminator.\r
786\r
787**/\r
788UINTN\r
789EFIAPI\r
790UnicodeSPrintAsciiFormat (\r
791 OUT CHAR16 *StartOfBuffer,\r
792 IN UINTN BufferSize,\r
793 IN CONST CHAR8 *FormatString,\r
794 ...\r
795 )\r
796{\r
797 VA_LIST Marker;\r
3bbe68a3 798 UINTN NumberOfPrinted;\r
3eb9473e 799\r
800 VA_START (Marker, FormatString);\r
3bbe68a3 801 NumberOfPrinted = UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r
802 VA_END (Marker);\r
803 return NumberOfPrinted;\r
3eb9473e 804}\r
805\r
806/**\r
807 Converts a decimal value to a Null-terminated Unicode string.\r
808 \r
809 Converts the decimal number specified by Value to a Null-terminated Unicode \r
810 string specified by Buffer containing at most Width characters. No padding of spaces \r
811 is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
812 The number of Unicode characters in Buffer is returned not including the Null-terminator.\r
813 If the conversion contains more than Width characters, then only the first\r
814 Width characters are returned, and the total number of characters \r
815 required to perform the conversion is returned.\r
816 Additional conversion parameters are specified in Flags. \r
817 \r
818 The Flags bit LEFT_JUSTIFY is always ignored.\r
819 All conversions are left justified in Buffer.\r
820 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
821 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
822 are inserted every 3rd digit starting from the right.\r
df8d0595 823 If RADIX_HEX is set in Flags, then the output buffer will be \r
3eb9473e 824 formatted in hexadecimal format.\r
df8d0595 825 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.\r
3eb9473e 826 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
827 then Buffer is padded with '0' characters so the combination of the optional '-' \r
828 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
829 add up to Width characters.\r
df8d0595 830 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r
3eb9473e 831 If Buffer is NULL, then ASSERT().\r
832 If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
833 If unsupported bits are set in Flags, then ASSERT().\r
df8d0595 834 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r
3eb9473e 835 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
836\r
837 @param Buffer Pointer to the output buffer for the produced Null-terminated\r
838 Unicode string.\r
839 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r
840 @param Value The 64-bit signed value to convert to a string.\r
841 @param Width The maximum number of Unicode characters to place in Buffer, not including\r
842 the Null-terminator.\r
843 \r
844 @return The number of Unicode characters in Buffer not including the Null-terminator.\r
845\r
846**/\r
847UINTN\r
848EFIAPI\r
849UnicodeValueToString (\r
850 IN OUT CHAR16 *Buffer,\r
851 IN UINTN Flags,\r
852 IN INT64 Value,\r
853 IN UINTN Width\r
854 )\r
855{\r
856 ASSERT_UNICODE_BUFFER(Buffer);\r
857 return BasePrintLibConvertValueToString ((CHAR8 *)Buffer, Flags, Value, Width, 2);\r
858}\r
859\r
860/**\r
861 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
862 ASCII format string and a VA_LIST argument list.\r
863 \r
864 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
865 and BufferSize.\r
866 The ASCII string is produced by parsing the format string specified by FormatString.\r
867 Arguments are pulled from the variable argument list specified by Marker based on \r
868 the contents of the format string.\r
869 The number of ASCII characters in the produced output buffer is returned not including\r
870 the Null-terminator.\r
871 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
872\r
873 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
874 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
875 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
876 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
877 ASSERT().\r
878 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
879 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
880 Null-terminator, then ASSERT().\r
881\r
882 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
883 ASCII string.\r
884 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
885 @param FormatString Null-terminated Unicode format string.\r
886 @param Marker VA_LIST marker for the variable argument list.\r
887 \r
888 @return The number of ASCII characters in the produced output buffer not including the\r
889 Null-terminator.\r
890\r
891**/\r
892UINTN\r
893EFIAPI\r
894AsciiVSPrint (\r
895 OUT CHAR8 *StartOfBuffer,\r
896 IN UINTN BufferSize,\r
897 IN CONST CHAR8 *FormatString,\r
898 IN VA_LIST Marker\r
899 )\r
900{\r
901 return BasePrintLibVSPrint (StartOfBuffer, BufferSize, 0, FormatString, Marker);\r
902}\r
903\r
904/**\r
905 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
906 ASCII format string and variable argument list.\r
907 \r
908 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
909 and BufferSize.\r
910 The ASCII string is produced by parsing the format string specified by FormatString.\r
911 Arguments are pulled from the variable argument list based on the contents of the \r
912 format string.\r
913 The number of ASCII characters in the produced output buffer is returned not including\r
914 the Null-terminator.\r
915 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
916\r
917 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
918 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
919 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
920 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
921 ASSERT().\r
922 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
923 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
924 Null-terminator, then ASSERT().\r
925\r
926 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
927 ASCII string.\r
928 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
929 @param FormatString Null-terminated Unicode format string.\r
930 \r
931 @return The number of ASCII characters in the produced output buffer not including the\r
932 Null-terminator.\r
933\r
934**/\r
935UINTN\r
936EFIAPI\r
937AsciiSPrint (\r
938 OUT CHAR8 *StartOfBuffer,\r
939 IN UINTN BufferSize,\r
940 IN CONST CHAR8 *FormatString,\r
941 ...\r
942 )\r
943{\r
944 VA_LIST Marker;\r
3bbe68a3 945 UINTN NumberOfPrinted;\r
3eb9473e 946\r
947 VA_START (Marker, FormatString);\r
3bbe68a3 948 NumberOfPrinted = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r
949 VA_END (Marker);\r
950 return NumberOfPrinted;\r
3eb9473e 951}\r
952\r
953/**\r
954 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
955 ASCII format string and a VA_LIST argument list.\r
956 \r
957 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
958 and BufferSize.\r
959 The ASCII string is produced by parsing the format string specified by FormatString.\r
960 Arguments are pulled from the variable argument list specified by Marker based on \r
961 the contents of the format string.\r
962 The number of ASCII characters in the produced output buffer is returned not including\r
963 the Null-terminator.\r
964 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
965\r
966 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
967 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
968 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
969 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
970 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
971 ASSERT().\r
972 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
973 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
974 Null-terminator, then ASSERT().\r
975\r
976 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
977 ASCII string.\r
978 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
979 @param FormatString Null-terminated Unicode format string.\r
980 @param Marker VA_LIST marker for the variable argument list.\r
981 \r
982 @return The number of ASCII characters in the produced output buffer not including the\r
983 Null-terminator.\r
984\r
985**/\r
986UINTN\r
987EFIAPI\r
988AsciiVSPrintUnicodeFormat (\r
989 OUT CHAR8 *StartOfBuffer,\r
990 IN UINTN BufferSize,\r
991 IN CONST CHAR16 *FormatString,\r
992 IN VA_LIST Marker\r
993 )\r
994{\r
995 ASSERT_UNICODE_BUFFER (FormatString);\r
996 return BasePrintLibVSPrint (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, Marker);\r
997}\r
998\r
999/**\r
1000 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
1001 ASCII format string and variable argument list.\r
1002 \r
1003 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
1004 and BufferSize.\r
1005 The ASCII string is produced by parsing the format string specified by FormatString.\r
1006 Arguments are pulled from the variable argument list based on the contents of the \r
1007 format string.\r
1008 The number of ASCII characters in the produced output buffer is returned not including\r
1009 the Null-terminator.\r
1010 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
1011\r
1012 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
1013 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
1014 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
1015 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
1016 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
1017 ASSERT().\r
1018 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
1019 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
1020 Null-terminator, then ASSERT().\r
1021\r
1022 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
1023 ASCII string.\r
1024 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
1025 @param FormatString Null-terminated Unicode format string.\r
1026 \r
1027 @return The number of ASCII characters in the produced output buffer not including the\r
1028 Null-terminator.\r
1029\r
1030**/\r
1031UINTN\r
1032EFIAPI\r
1033AsciiSPrintUnicodeFormat (\r
1034 OUT CHAR8 *StartOfBuffer,\r
1035 IN UINTN BufferSize,\r
1036 IN CONST CHAR16 *FormatString,\r
1037 ...\r
1038 )\r
1039{\r
1040 VA_LIST Marker;\r
3bbe68a3 1041 UINTN NumberOfPrinted;\r
3eb9473e 1042\r
1043 VA_START (Marker, FormatString);\r
3bbe68a3 1044 NumberOfPrinted = AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r
1045 VA_END (Marker);\r
1046 return NumberOfPrinted;\r
3eb9473e 1047}\r
1048\r
1049\r
1050/**\r
1051 Converts a decimal value to a Null-terminated ASCII string.\r
1052 \r
1053 Converts the decimal number specified by Value to a Null-terminated ASCII string \r
1054 specified by Buffer containing at most Width characters. No padding of spaces \r
1055 is ever performed.\r
1056 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
1057 The number of ASCII characters in Buffer is returned not including the Null-terminator.\r
1058 If the conversion contains more than Width characters, then only the first Width\r
1059 characters are returned, and the total number of characters required to perform\r
1060 the conversion is returned.\r
1061 Additional conversion parameters are specified in Flags. \r
1062 The Flags bit LEFT_JUSTIFY is always ignored.\r
1063 All conversions are left justified in Buffer.\r
1064 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
1065 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
1066 are inserted every 3rd digit starting from the right.\r
df8d0595 1067 If RADIX_HEX is set in Flags, then the output buffer will be \r
3eb9473e 1068 formatted in hexadecimal format.\r
df8d0595 1069 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.\r
3eb9473e 1070 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
1071 then Buffer is padded with '0' characters so the combination of the optional '-' \r
1072 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
1073 add up to Width characters.\r
1074 \r
1075 If Buffer is NULL, then ASSERT().\r
1076 If unsupported bits are set in Flags, then ASSERT().\r
df8d0595 1077 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r
3eb9473e 1078 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
1079\r
1080 @param Buffer Pointer to the output buffer for the produced Null-terminated\r
1081 ASCII string.\r
1082 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r
1083 @param Value The 64-bit signed value to convert to a string.\r
1084 @param Width The maximum number of ASCII characters to place in Buffer, not including\r
1085 the Null-terminator.\r
1086 \r
1087 @return The number of ASCII characters in Buffer not including the Null-terminator.\r
1088\r
1089**/\r
1090UINTN\r
1091EFIAPI\r
1092AsciiValueToString (\r
1093 IN OUT CHAR8 *Buffer,\r
1094 IN UINTN Flags,\r
1095 IN INT64 Value,\r
1096 IN UINTN Width\r
1097 )\r
1098{\r
1099 return BasePrintLibConvertValueToString (Buffer, Flags, Value, Width, 1);\r
1100}\r
1101\r