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