]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/TianoTools/String/PrintLib.c
Removed one useless makefile, and corrected some BSD licenses
[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
406 ArgumentString = "\r\n";\r
407 break;\r
408 default:\r
409 ArgumentString = (CHAR8 *)&FormatCharacter;\r
410 Flags |= ARGUMENT_UNICODE;\r
411 break;\r
412 }\r
413\r
414 //\r
415 // Retrieve the ArgumentString attriubutes\r
416 //\r
417 if ((Flags & ARGUMENT_UNICODE) != 0) {\r
418 ArgumentMask = 0xffff;\r
419 BytesPerArgumentCharacter = 2;\r
420 } else {\r
421 ArgumentMask = 0xff;\r
422 BytesPerArgumentCharacter = 1;\r
423 }\r
424 if ((Flags & ARGUMENT_REVERSED) != 0) {\r
425 BytesPerArgumentCharacter = -BytesPerArgumentCharacter;\r
426 } else {\r
427 //\r
428 // Compute the number of characters in ArgumentString and store it in Count\r
429 // ArgumentString is either null-terminated, or it contains Precision characters\r
430 //\r
431 for (Count = 0; Count < Precision || ((Flags & PRECISION) == 0); Count++) {\r
432 ArgumentCharacter = ((ArgumentString[Count * BytesPerArgumentCharacter] & 0xff) | ((ArgumentString[Count * BytesPerArgumentCharacter + 1]) << 8)) & ArgumentMask;\r
433 if (ArgumentCharacter == 0) {\r
434 break;\r
435 }\r
436 }\r
437 }\r
438\r
439 //\r
440 // Limit the length of the string to append to the remaining characters in the output buffer\r
441 //\r
442 if (Count > BufferSize) {\r
443 Count = BufferSize;\r
444 }\r
445 if (Precision < Count) {\r
446 Precision = Count;\r
447 }\r
448\r
449 //\r
450 // Pad before the string\r
451 //\r
452 if ((Flags & (PAD_TO_WIDTH | LEFT_JUSTIFY)) == (PAD_TO_WIDTH)) {\r
453 Buffer = BasePrintLibFillBuffer (Buffer, Width - Precision, ' ', BytesPerOutputCharacter);\r
454 }\r
455\r
456 if (ZeroPad) {\r
457 if (Prefix != 0) {\r
458 Buffer = BasePrintLibFillBuffer (Buffer, 1, Prefix, BytesPerOutputCharacter);\r
459 }\r
460 Buffer = BasePrintLibFillBuffer (Buffer, Precision - Count, '0', BytesPerOutputCharacter);\r
461 } else {\r
462 Buffer = BasePrintLibFillBuffer (Buffer, Precision - Count, ' ', BytesPerOutputCharacter);\r
463 if (Prefix != 0) {\r
464 Buffer = BasePrintLibFillBuffer (Buffer, 1, Prefix, BytesPerOutputCharacter);\r
465 }\r
466 }\r
467\r
468 //\r
469 // Output the Prefix character if it is present\r
470 //\r
471 Index = 0;\r
472 if (Prefix) {\r
473 Index++;\r
474 }\r
475\r
476 //\r
477 // Copy the string into the output buffer performing the required type conversions\r
478 //\r
479 while (Index < Count) {\r
480 ArgumentCharacter = ((*ArgumentString & 0xff) | (*(ArgumentString + 1) << 8)) & ArgumentMask;\r
481\r
482 Buffer = BasePrintLibFillBuffer (Buffer, 1, ArgumentCharacter, BytesPerOutputCharacter);\r
483 ArgumentString += BytesPerArgumentCharacter;\r
484 Index++;\r
485 if (Comma) {\r
486 Digits++;\r
487 if (Digits == 3) {\r
488 Digits = 0;\r
489 Index++;\r
490 if (Index < Count) {\r
491 Buffer = BasePrintLibFillBuffer (Buffer, 1, ',', BytesPerOutputCharacter);\r
492 }\r
493 }\r
494 }\r
495 }\r
496\r
497 //\r
498 // Pad after the string\r
499 //\r
500 if ((Flags & (PAD_TO_WIDTH | LEFT_JUSTIFY)) == (PAD_TO_WIDTH | LEFT_JUSTIFY)) {\r
501 Buffer = BasePrintLibFillBuffer (Buffer, Width - Precision, ' ', BytesPerOutputCharacter);\r
502 }\r
503\r
504 //\r
505 // Reduce the number of characters\r
506 //\r
507 BufferSize -= Count;\r
508\r
509 //\r
510 // Get the next character from the format string\r
511 //\r
512 Format += BytesPerFormatCharacter;\r
513\r
514 //\r
515 // Get the next character from the format string\r
516 //\r
517 FormatCharacter = (*Format | (*(Format + 1) << 8)) & FormatMask;\r
518 }\r
519\r
520 //\r
521 // Null terminate the Unicode or ASCII string\r
522 //\r
523 Buffer = BasePrintLibFillBuffer (Buffer, 1, 0, BytesPerOutputCharacter);\r
56fe62ce 524\r
d2ec0d9e 525 return ((Buffer - OriginalBuffer) / BytesPerOutputCharacter);\r
526}\r
527\r
528UINTN\r
529BasePrintLibSPrint (\r
530 OUT CHAR8 *StartOfBuffer,\r
531 IN UINTN BufferSize,\r
532 IN UINTN Flags,\r
533 IN CONST CHAR8 *FormatString,\r
534 ...\r
535 )\r
536{\r
537 VA_LIST Marker;\r
538\r
539 VA_START (Marker, FormatString);\r
540 return BasePrintLibVSPrint (StartOfBuffer, BufferSize, Flags, FormatString, Marker);\r
541}\r
542\r
543UINTN\r
544EFIAPI\r
545UnicodeVSPrint (\r
546 OUT CHAR16 *StartOfBuffer,\r
547 IN UINTN BufferSize,\r
548 IN CONST CHAR16 *FormatString,\r
549 IN VA_LIST Marker\r
550 )\r
551{\r
552 return BasePrintLibVSPrint ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, Marker);\r
553}\r
554\r
555UINTN\r
556EFIAPI\r
557UnicodeSPrint (\r
558 OUT CHAR16 *StartOfBuffer,\r
559 IN UINTN BufferSize,\r
560 IN CONST CHAR16 *FormatString,\r
561 ...\r
562 )\r
563{\r
564 VA_LIST Marker;\r
565\r
566 VA_START (Marker, FormatString);\r
567 return UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r
568}\r
569\r
570UINTN\r
571EFIAPI\r
572UnicodeVSPrintAsciiFormat (\r
573 OUT CHAR16 *StartOfBuffer,\r
574 IN UINTN BufferSize,\r
575 IN CONST CHAR8 *FormatString,\r
576 IN VA_LIST Marker\r
577 )\r
578{\r
579 return BasePrintLibVSPrint ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE,FormatString, Marker);\r
580}\r
581\r
582UINTN\r
583EFIAPI\r
584UnicodeSPrintAsciiFormat (\r
585 OUT CHAR16 *StartOfBuffer,\r
586 IN UINTN BufferSize,\r
587 IN CONST CHAR8 *FormatString,\r
588 ...\r
589 )\r
590{\r
591 VA_LIST Marker;\r
592\r
593 VA_START (Marker, FormatString);\r
594 return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize >> 1, FormatString, Marker);\r
595}\r
596\r
597UINTN\r
598EFIAPI\r
599AsciiVSPrint (\r
600 OUT CHAR8 *StartOfBuffer,\r
601 IN UINTN BufferSize,\r
602 IN CONST CHAR8 *FormatString,\r
603 IN VA_LIST Marker\r
604 )\r
605{\r
606 return BasePrintLibVSPrint (StartOfBuffer, BufferSize, 0, FormatString, Marker);\r
607}\r
608\r
609UINTN\r
610EFIAPI\r
611AsciiSPrint (\r
612 OUT CHAR8 *StartOfBuffer,\r
613 IN UINTN BufferSize,\r
614 IN CONST CHAR8 *FormatString,\r
615 ...\r
616 )\r
617{\r
618 VA_LIST Marker;\r
619\r
620 VA_START (Marker, FormatString);\r
621 return AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r
622}\r
623\r
624UINTN\r
625EFIAPI\r
626AsciiVSPrintUnicodeFormat (\r
627 OUT CHAR8 *StartOfBuffer,\r
628 IN UINTN BufferSize,\r
629 IN CONST CHAR16 *FormatString,\r
630 IN VA_LIST Marker\r
631 )\r
632{\r
633 return BasePrintLibVSPrint (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, Marker);\r
634}\r
635\r
636UINTN\r
637EFIAPI\r
638AsciiSPrintUnicodeFormat (\r
639 OUT CHAR8 *StartOfBuffer,\r
640 IN UINTN BufferSize,\r
641 IN CONST CHAR16 *FormatString,\r
642 ...\r
643 )\r
644{\r
645 VA_LIST Marker;\r
646\r
647 VA_START (Marker, FormatString);\r
648 return AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r
649}\r
650\r
651UINTN\r
652EFIAPI\r
653UnicodeValueToString (\r
654 IN OUT CHAR16 *Buffer,\r
655 IN UINTN Flags,\r
656 IN INT64 Value,\r
657 IN UINTN Width\r
658 )\r
659{\r
660 return BasePrintLibConvertValueToString ((CHAR8 *)Buffer, Flags, Value, Width, 2);\r
661}\r
662\r
663UINTN\r
664EFIAPI\r
665AsciiValueToString (\r
666 IN OUT CHAR8 *Buffer,\r
667 IN UINTN Flags,\r
668 IN INT64 Value,\r
669 IN UINTN Width\r
670 )\r
671{\r
672 return BasePrintLibConvertValueToString ((CHAR8 *)Buffer, Flags, Value, Width, 1);\r
673}\r