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