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