]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/TianoTools/String/PrintLib.c
fixed EDKT139.
[mirror_edk2.git] / Tools / Source / TianoTools / String / PrintLib.c
CommitLineData
56fe62ce 1/*++\r
cf171110 2\r
3Copyright (c) 2004-2006 Intel Corporation. All rights reserved\r
56fe62ce 4This program and the accompanying materials are licensed and made available\r
5under the terms and conditions of the BSD License which accompanies this\r
6distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
d2ec0d9e 8\r
56fe62ce 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
d2ec0d9e 11\r
d2ec0d9e 12\r
56fe62ce 13Module Name:\r
14\r
15 PrintLib.c\r
16\r
17Abstract:\r
18\r
19 Print Library.\r
20\r
21--*/\r
d2ec0d9e 22\r
ce53a8c3 23#include <Common/UefiBaseTypes.h>\r
24#include <Library/PrintLib.h>\r
25\r
26#include "CommonLib.h"\r
d2ec0d9e 27#include "PrintLibInternal.h"\r
28\r
29typedef struct {\r
30 RETURN_STATUS Status;\r
31 CHAR8 *String;\r
32} STATUS_LOOKUP_TABLE_ENTRY;\r
33\r
34static CONST STATUS_LOOKUP_TABLE_ENTRY StatusString[] = {\r
35 { RETURN_SUCCESS, "Success" },\r
36 { RETURN_LOAD_ERROR, "Load Error" },\r
37 { RETURN_INVALID_PARAMETER, "Invalid Parameter" },\r
38 { RETURN_UNSUPPORTED, "Unsupported" },\r
39 { RETURN_BAD_BUFFER_SIZE, "Bad Buffer Size" },\r
40 { RETURN_BUFFER_TOO_SMALL, "Buffer Too Small" },\r
41 { RETURN_NOT_READY, "Not Ready" },\r
42 { RETURN_DEVICE_ERROR, "Device Error" },\r
43 { RETURN_WRITE_PROTECTED, "Write Protected" },\r
44 { RETURN_OUT_OF_RESOURCES, "Out of Resources" },\r
45 { RETURN_VOLUME_CORRUPTED, "Volume Corrupt" },\r
46 { RETURN_VOLUME_FULL, "Volume Full" },\r
47 { RETURN_NO_MEDIA, "No Media" },\r
48 { RETURN_MEDIA_CHANGED, "Media changed" },\r
49 { RETURN_NOT_FOUND, "Not Found" },\r
50 { RETURN_ACCESS_DENIED, "Access Denied" },\r
51 { RETURN_NO_RESPONSE, "No Response" },\r
52 { RETURN_NO_MAPPING, "No mapping" },\r
53 { RETURN_TIMEOUT, "Time out" },\r
54 { RETURN_NOT_STARTED, "Not started" },\r
55 { RETURN_ALREADY_STARTED, "Already started" },\r
56 { RETURN_ABORTED, "Aborted" },\r
57 { RETURN_ICMP_ERROR, "ICMP Error" },\r
58 { RETURN_TFTP_ERROR, "TFTP Error" },\r
59 { RETURN_PROTOCOL_ERROR, "Protocol Error" },\r
60 { RETURN_WARN_UNKNOWN_GLYPH, "Warning Unknown Glyph" },\r
61 { RETURN_WARN_DELETE_FAILURE, "Warning Delete Failure" },\r
62 { RETURN_WARN_WRITE_FAILURE, "Warning Write Failure" },\r
63 { RETURN_WARN_BUFFER_TOO_SMALL, "Warning Buffer Too Small" },\r
64 { 0, NULL }\r
65};\r
66\r
67\r
68/**\r
56fe62ce 69 VSPrint function to process format and place the results in Buffer. Since a\r
70 VA_LIST is used this rountine allows the nesting of Vararg routines. Thus\r
d2ec0d9e 71 this is the main print working routine\r
72\r
73 @param StartOfBuffer Unicode buffer to print the results of the parsing of Format into.\r
56fe62ce 74\r
d2ec0d9e 75 @param BufferSize Maximum number of characters to put into buffer. Zero means\r
76 no limit.\r
56fe62ce 77\r
d2ec0d9e 78 @param Flags Intial flags value. Can only have FORMAT_UNICODE and OUTPUT_UNICODE set\r
56fe62ce 79\r
d2ec0d9e 80 @param FormatString Unicode format string see file header for more details.\r
56fe62ce 81\r
d2ec0d9e 82 @param Marker Vararg list consumed by processing Format.\r
83\r
84 @return Number of characters printed.\r
85\r
86**/\r
87UINTN\r
88BasePrintLibVSPrint (\r
89 OUT CHAR8 *Buffer,\r
90 IN UINTN BufferSize,\r
91 IN UINTN Flags,\r
92 IN CONST CHAR8 *Format,\r
93 IN VA_LIST Marker\r
94 )\r
95{\r
96 CHAR8 *OriginalBuffer;\r
97 CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS];\r
98 UINTN BytesPerOutputCharacter;\r
99 UINTN BytesPerFormatCharacter;\r
100 UINTN FormatMask;\r
101 UINTN FormatCharacter;\r
102 UINTN Width;\r
103 UINTN Precision;\r
104 INT64 Value;\r
105 CHAR8 *ArgumentString;\r
106 UINTN Character;\r
107 GUID *TmpGuid;\r
108 TIME *TmpTime;\r
109 UINTN Count;\r
110 UINTN ArgumentMask;\r
111 INTN BytesPerArgumentCharacter;\r
112 UINTN ArgumentCharacter;\r
113 BOOLEAN Done;\r
114 UINTN Index;\r
115 CHAR8 Prefix;\r
116 BOOLEAN ZeroPad;\r
117 BOOLEAN Comma;\r
118 UINTN Digits;\r
119 UINTN Radix;\r
120 RETURN_STATUS Status;\r
121\r
122 OriginalBuffer = Buffer;\r
123\r
124 if ((Flags & OUTPUT_UNICODE) != 0) {\r
125 BytesPerOutputCharacter = 2;\r
126 } else {\r
127 BytesPerOutputCharacter = 1;\r
128 }\r
129 if ((Flags & FORMAT_UNICODE) != 0) {\r
130 BytesPerFormatCharacter = 2;\r
131 FormatMask = 0xffff;\r
132 } else {\r
133 BytesPerFormatCharacter = 1;\r
134 FormatMask = 0xff;\r
135 }\r
136\r
137 //\r
138 // Reserve space for the Null terminator.\r
139 // If BufferSize is 0, this will set BufferSize to the max unsigned value\r
140 //\r
141 BufferSize--;\r
142\r
143 //\r
144 // Get the first character from the format string\r
145 //\r
146 FormatCharacter = (*Format | (*(Format + 1) << 8)) & FormatMask;\r
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
56fe62ce 177 case '.':\r
178 Flags |= PRECISION;\r
d2ec0d9e 179 break;\r
56fe62ce 180 case '-':\r
181 Flags |= LEFT_JUSTIFY;\r
d2ec0d9e 182 break;\r
56fe62ce 183 case '+':\r
184 Flags |= PREFIX_SIGN;\r
d2ec0d9e 185 break;\r
56fe62ce 186 case ' ':\r
187 Flags |= PREFIX_BLANK;\r
d2ec0d9e 188 break;\r
56fe62ce 189 case ',':\r
190 Flags |= COMMA_TYPE;\r
d2ec0d9e 191 break;\r
192 case 'L':\r
56fe62ce 193 case 'l':\r
194 Flags |= LONG_TYPE;\r
d2ec0d9e 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
230 default:\r
231 Done = TRUE;\r
232 break;\r
233 }\r
56fe62ce 234 }\r
d2ec0d9e 235\r
236 //\r
237 // Limit the maximum field width to the remaining characters in the output buffer\r
238 //\r
239 if (Width > BufferSize) {\r
240 Width = BufferSize;\r
241 }\r
242\r
243 //\r
244 // Handle each argument type\r
245 //\r
246 switch (FormatCharacter) {\r
247 case 'X':\r
248 Flags |= PREFIX_ZERO;\r
249 //\r
250 // break skiped on purpose\r
251 //\r
252 case 'x':\r
253 Flags |= RADIX_HEX;\r
254 //\r
255 // break skiped on purpose\r
256 //\r
257 case 'd':\r
258 if ((Flags & LONG_TYPE) == 0) {\r
259 Value = (VA_ARG (Marker, INTN));\r
260 } else {\r
261 Value = VA_ARG (Marker, INT64);\r
262 }\r
263 if ((Flags & PREFIX_BLANK) != 0) {\r
264 Prefix = ' ';\r
265 }\r
266 if ((Flags & PREFIX_SIGN) != 0) {\r
267 Prefix = '+';\r
268 }\r
269 if ((Flags & COMMA_TYPE) != 0) {\r
270 Comma = TRUE;\r
271 }\r
272 if ((Flags & RADIX_HEX) == 0) {\r
273 Radix = 10;\r
274 if (Comma) {\r
275 Flags &= (~PREFIX_ZERO);\r
276 Precision = 1;\r
277 }\r
278 if (Value < 0) {\r
279 Flags |= PREFIX_SIGN;\r
280 Prefix = '-';\r
281 Value = -Value;\r
282 }\r
283 } else {\r
284 Radix = 16;\r
285 Comma = FALSE;\r
286 if ((Flags & LONG_TYPE) == 0 && Value < 0) {\r
287 Value = (UINTN)Value;\r
288 }\r
289 }\r
290 //\r
291 // Convert Value to a reversed string\r
292 //\r
293 Count = BasePrintLibValueToString (ValueBuffer, Value, Radix);\r
294 if (Value == 0 && Precision == 0) {\r
295 Count = 0;\r
296 }\r
297 ArgumentString = (CHAR8 *)ValueBuffer + Count;\r
298 Digits = 3 - (Count % 3);\r
299 if (Comma && Count != 0) {\r
300 Count += ((Count - 1) / 3);\r
301 }\r
302 if (Prefix != 0) {\r
303 Count++;\r
304 }\r
305 Flags |= ARGUMENT_REVERSED;\r
306 ZeroPad = TRUE;\r
307 if ((Flags & PREFIX_ZERO) != 0) {\r
308 if ((Flags & PAD_TO_WIDTH) != 0) {\r
309 if ((Flags & PRECISION) == 0) {\r
310 Precision = Width;\r
311 }\r
312 }\r
313 }\r
314 break;\r
315\r
316 case 's':\r
317 case 'S':\r
318 Flags |= ARGUMENT_UNICODE;\r
319 //\r
320 // break skipped on purpose\r
321 //\r
322 case 'a':\r
323 ArgumentString = (CHAR8 *)VA_ARG (Marker, CHAR8 *);\r
324 if (ArgumentString == NULL) {\r
325 Flags &= (~ARGUMENT_UNICODE);\r
326 ArgumentString = "<null string>";\r
327 }\r
328 break;\r
329\r
330 case 'c':\r
331 Character = VA_ARG (Marker, UINTN) & 0xffff;\r
332 ArgumentString = (CHAR8 *)&Character;\r
333 Flags |= ARGUMENT_UNICODE;\r
334 break;\r
335\r
336 case 'g':\r
337 TmpGuid = VA_ARG (Marker, GUID *);\r
338 if (TmpGuid == NULL) {\r
339 ArgumentString = "<null guid>";\r
340 } else {\r
341 BasePrintLibSPrint (\r
342 ValueBuffer,\r
56fe62ce 343 0,\r
d2ec0d9e 344 0,\r
345 "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",\r
346 TmpGuid->Data1,\r
347 TmpGuid->Data2,\r
348 TmpGuid->Data3,\r
349 TmpGuid->Data4[0],\r
350 TmpGuid->Data4[1],\r
351 TmpGuid->Data4[2],\r
352 TmpGuid->Data4[3],\r
353 TmpGuid->Data4[4],\r
354 TmpGuid->Data4[5],\r
355 TmpGuid->Data4[6],\r
356 TmpGuid->Data4[7]\r
357 );\r
358 ArgumentString = ValueBuffer;\r
359 }\r
360 break;\r
361\r
362 case 't':\r
56fe62ce 363 TmpTime = VA_ARG (Marker, TIME *);\r
d2ec0d9e 364 if (TmpTime == NULL) {\r
365 ArgumentString = "<null time>";\r
366 } else {\r
367 BasePrintLibSPrint (\r
368 ValueBuffer,\r
369 0,\r
370 0,\r
371 "%02d/%02d/%04d %02d:%02d",\r
372 TmpTime->Month,\r
373 TmpTime->Day,\r
374 TmpTime->Year,\r
375 TmpTime->Hour,\r
376 TmpTime->Minute\r
377 );\r
378 ArgumentString = ValueBuffer;\r
379 }\r
380 break;\r
381\r
382 case 'r':\r
383 Status = VA_ARG (Marker, RETURN_STATUS);\r
384 ArgumentString = ValueBuffer;\r
385 for (Index = 0; StatusString[Index].String != NULL; Index++) {\r
386 if (Status == StatusString[Index].Status) {\r
387 ArgumentString = StatusString[Index].String;\r
388 }\r
389 }\r
390 if (ArgumentString == ValueBuffer) {\r
391 BasePrintLibSPrint ((CHAR8 *) ValueBuffer, 0, 0, "%08X", Status);\r
392 }\r
393 break;\r
394\r
395 case '%':\r
396 default:\r
397 //\r
398 // if the type is '%' or unknown, then print it to the screen\r
399 //\r
400 ArgumentString = (CHAR8 *)&FormatCharacter;\r
401 Flags |= ARGUMENT_UNICODE;\r
402 break;\r
403 }\r
404 break;\r
405 case '\n':\r
ea62f12a 406 ArgumentString = "\n";\r
407 \r
d2ec0d9e 408 break;\r
409 default:\r
410 ArgumentString = (CHAR8 *)&FormatCharacter;\r
411 Flags |= ARGUMENT_UNICODE;\r
412 break;\r
413 }\r
414\r
415 //\r
416 // Retrieve the ArgumentString attriubutes\r
417 //\r
418 if ((Flags & ARGUMENT_UNICODE) != 0) {\r
419 ArgumentMask = 0xffff;\r
420 BytesPerArgumentCharacter = 2;\r
421 } else {\r
422 ArgumentMask = 0xff;\r
423 BytesPerArgumentCharacter = 1;\r
424 }\r
425 if ((Flags & ARGUMENT_REVERSED) != 0) {\r
426 BytesPerArgumentCharacter = -BytesPerArgumentCharacter;\r
427 } else {\r
428 //\r
429 // Compute the number of characters in ArgumentString and store it in Count\r
430 // ArgumentString is either null-terminated, or it contains Precision characters\r
431 //\r
432 for (Count = 0; Count < Precision || ((Flags & PRECISION) == 0); Count++) {\r
433 ArgumentCharacter = ((ArgumentString[Count * BytesPerArgumentCharacter] & 0xff) | ((ArgumentString[Count * BytesPerArgumentCharacter + 1]) << 8)) & ArgumentMask;\r
434 if (ArgumentCharacter == 0) {\r
435 break;\r
436 }\r
437 }\r
438 }\r
439\r
440 //\r
441 // Limit the length of the string to append to the remaining characters in the output buffer\r
442 //\r
443 if (Count > BufferSize) {\r
444 Count = BufferSize;\r
445 }\r
446 if (Precision < Count) {\r
447 Precision = Count;\r
448 }\r
449\r
450 //\r
451 // Pad before the string\r
452 //\r
453 if ((Flags & (PAD_TO_WIDTH | LEFT_JUSTIFY)) == (PAD_TO_WIDTH)) {\r
454 Buffer = BasePrintLibFillBuffer (Buffer, Width - Precision, ' ', BytesPerOutputCharacter);\r
455 }\r
456\r
457 if (ZeroPad) {\r
458 if (Prefix != 0) {\r
459 Buffer = BasePrintLibFillBuffer (Buffer, 1, Prefix, BytesPerOutputCharacter);\r
460 }\r
461 Buffer = BasePrintLibFillBuffer (Buffer, Precision - Count, '0', BytesPerOutputCharacter);\r
462 } else {\r
463 Buffer = BasePrintLibFillBuffer (Buffer, Precision - Count, ' ', BytesPerOutputCharacter);\r
464 if (Prefix != 0) {\r
465 Buffer = BasePrintLibFillBuffer (Buffer, 1, Prefix, BytesPerOutputCharacter);\r
466 }\r
467 }\r
468\r
469 //\r
470 // Output the Prefix character if it is present\r
471 //\r
472 Index = 0;\r
473 if (Prefix) {\r
474 Index++;\r
475 }\r
476\r
477 //\r
478 // Copy the string into the output buffer performing the required type conversions\r
479 //\r
480 while (Index < Count) {\r
481 ArgumentCharacter = ((*ArgumentString & 0xff) | (*(ArgumentString + 1) << 8)) & ArgumentMask;\r
482\r
483 Buffer = BasePrintLibFillBuffer (Buffer, 1, ArgumentCharacter, BytesPerOutputCharacter);\r
484 ArgumentString += BytesPerArgumentCharacter;\r
485 Index++;\r
486 if (Comma) {\r
487 Digits++;\r
488 if (Digits == 3) {\r
489 Digits = 0;\r
490 Index++;\r
491 if (Index < Count) {\r
492 Buffer = BasePrintLibFillBuffer (Buffer, 1, ',', BytesPerOutputCharacter);\r
493 }\r
494 }\r
495 }\r
496 }\r
497\r
498 //\r
499 // Pad after the string\r
500 //\r
501 if ((Flags & (PAD_TO_WIDTH | LEFT_JUSTIFY)) == (PAD_TO_WIDTH | LEFT_JUSTIFY)) {\r
502 Buffer = BasePrintLibFillBuffer (Buffer, Width - Precision, ' ', BytesPerOutputCharacter);\r
503 }\r
504\r
505 //\r
506 // Reduce the number of characters\r
507 //\r
508 BufferSize -= Count;\r
509\r
510 //\r
511 // Get the next character from the format string\r
512 //\r
513 Format += BytesPerFormatCharacter;\r
514\r
515 //\r
516 // Get the next character from the format string\r
517 //\r
518 FormatCharacter = (*Format | (*(Format + 1) << 8)) & FormatMask;\r
519 }\r
520\r
521 //\r
522 // Null terminate the Unicode or ASCII string\r
523 //\r
524 Buffer = BasePrintLibFillBuffer (Buffer, 1, 0, BytesPerOutputCharacter);\r
56fe62ce 525\r
d2ec0d9e 526 return ((Buffer - OriginalBuffer) / BytesPerOutputCharacter);\r
527}\r
528\r
529UINTN\r
530BasePrintLibSPrint (\r
531 OUT CHAR8 *StartOfBuffer,\r
532 IN UINTN BufferSize,\r
533 IN UINTN Flags,\r
534 IN CONST CHAR8 *FormatString,\r
535 ...\r
536 )\r
537{\r
538 VA_LIST Marker;\r
539\r
540 VA_START (Marker, FormatString);\r
541 return BasePrintLibVSPrint (StartOfBuffer, BufferSize, Flags, FormatString, Marker);\r
542}\r
543\r
544UINTN\r
545EFIAPI\r
546UnicodeVSPrint (\r
547 OUT CHAR16 *StartOfBuffer,\r
548 IN UINTN BufferSize,\r
549 IN CONST CHAR16 *FormatString,\r
550 IN VA_LIST Marker\r
551 )\r
552{\r
553 return BasePrintLibVSPrint ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, Marker);\r
554}\r
555\r
556UINTN\r
557EFIAPI\r
558UnicodeSPrint (\r
559 OUT CHAR16 *StartOfBuffer,\r
560 IN UINTN BufferSize,\r
561 IN CONST CHAR16 *FormatString,\r
562 ...\r
563 )\r
564{\r
565 VA_LIST Marker;\r
566\r
567 VA_START (Marker, FormatString);\r
568 return UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r
569}\r
570\r
571UINTN\r
572EFIAPI\r
573UnicodeVSPrintAsciiFormat (\r
574 OUT CHAR16 *StartOfBuffer,\r
575 IN UINTN BufferSize,\r
576 IN CONST CHAR8 *FormatString,\r
577 IN VA_LIST Marker\r
578 )\r
579{\r
580 return BasePrintLibVSPrint ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE,FormatString, Marker);\r
581}\r
582\r
583UINTN\r
584EFIAPI\r
585UnicodeSPrintAsciiFormat (\r
586 OUT CHAR16 *StartOfBuffer,\r
587 IN UINTN BufferSize,\r
588 IN CONST CHAR8 *FormatString,\r
589 ...\r
590 )\r
591{\r
592 VA_LIST Marker;\r
593\r
594 VA_START (Marker, FormatString);\r
595 return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize >> 1, FormatString, Marker);\r
596}\r
597\r
598UINTN\r
599EFIAPI\r
600AsciiVSPrint (\r
601 OUT CHAR8 *StartOfBuffer,\r
602 IN UINTN BufferSize,\r
603 IN CONST CHAR8 *FormatString,\r
604 IN VA_LIST Marker\r
605 )\r
606{\r
607 return BasePrintLibVSPrint (StartOfBuffer, BufferSize, 0, FormatString, Marker);\r
608}\r
609\r
610UINTN\r
611EFIAPI\r
612AsciiSPrint (\r
613 OUT CHAR8 *StartOfBuffer,\r
614 IN UINTN BufferSize,\r
615 IN CONST CHAR8 *FormatString,\r
616 ...\r
617 )\r
618{\r
619 VA_LIST Marker;\r
620\r
621 VA_START (Marker, FormatString);\r
622 return AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r
623}\r
624\r
625UINTN\r
626EFIAPI\r
627AsciiVSPrintUnicodeFormat (\r
628 OUT CHAR8 *StartOfBuffer,\r
629 IN UINTN BufferSize,\r
630 IN CONST CHAR16 *FormatString,\r
631 IN VA_LIST Marker\r
632 )\r
633{\r
634 return BasePrintLibVSPrint (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, Marker);\r
635}\r
636\r
637UINTN\r
638EFIAPI\r
639AsciiSPrintUnicodeFormat (\r
640 OUT CHAR8 *StartOfBuffer,\r
641 IN UINTN BufferSize,\r
642 IN CONST CHAR16 *FormatString,\r
643 ...\r
644 )\r
645{\r
646 VA_LIST Marker;\r
647\r
648 VA_START (Marker, FormatString);\r
649 return AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r
650}\r
651\r
652UINTN\r
653EFIAPI\r
654UnicodeValueToString (\r
655 IN OUT CHAR16 *Buffer,\r
656 IN UINTN Flags,\r
657 IN INT64 Value,\r
658 IN UINTN Width\r
659 )\r
660{\r
661 return BasePrintLibConvertValueToString ((CHAR8 *)Buffer, Flags, Value, Width, 2);\r
662}\r
663\r
664UINTN\r
665EFIAPI\r
666AsciiValueToString (\r
667 IN OUT CHAR8 *Buffer,\r
668 IN UINTN Flags,\r
669 IN INT64 Value,\r
670 IN UINTN Width\r
671 )\r
672{\r
673 return BasePrintLibConvertValueToString ((CHAR8 *)Buffer, Flags, Value, Width, 1);\r
674}\r