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