]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
2 | Print Library.\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation<BR>\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | Module Name: PrintLib.c\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #include "PrintLibInternal.h"\r | |
18 | \r | |
19 | typedef struct {\r | |
20 | RETURN_STATUS Status;\r | |
21 | CHAR8 *String;\r | |
22 | } STATUS_LOOKUP_TABLE_ENTRY;\r | |
23 | \r | |
24 | static CONST STATUS_LOOKUP_TABLE_ENTRY StatusString[] = {\r | |
25 | { RETURN_SUCCESS, "Success" },\r | |
26 | { RETURN_LOAD_ERROR, "Load Error" },\r | |
27 | { RETURN_INVALID_PARAMETER, "Invalid Parameter" },\r | |
28 | { RETURN_UNSUPPORTED, "Unsupported" },\r | |
29 | { RETURN_BAD_BUFFER_SIZE, "Bad Buffer Size" },\r | |
30 | { RETURN_BUFFER_TOO_SMALL, "Buffer Too Small" },\r | |
31 | { RETURN_NOT_READY, "Not Ready" },\r | |
32 | { RETURN_DEVICE_ERROR, "Device Error" },\r | |
33 | { RETURN_WRITE_PROTECTED, "Write Protected" },\r | |
34 | { RETURN_OUT_OF_RESOURCES, "Out of Resources" },\r | |
35 | { RETURN_VOLUME_CORRUPTED, "Volume Corrupt" },\r | |
36 | { RETURN_VOLUME_FULL, "Volume Full" },\r | |
37 | { RETURN_NO_MEDIA, "No Media" },\r | |
38 | { RETURN_MEDIA_CHANGED, "Media changed" },\r | |
39 | { RETURN_NOT_FOUND, "Not Found" },\r | |
40 | { RETURN_ACCESS_DENIED, "Access Denied" },\r | |
41 | { RETURN_NO_RESPONSE, "No Response" },\r | |
42 | { RETURN_NO_MAPPING, "No mapping" },\r | |
43 | { RETURN_TIMEOUT, "Time out" },\r | |
44 | { RETURN_NOT_STARTED, "Not started" },\r | |
45 | { RETURN_ALREADY_STARTED, "Already started" },\r | |
46 | { RETURN_ABORTED, "Aborted" },\r | |
47 | { RETURN_ICMP_ERROR, "ICMP Error" },\r | |
48 | { RETURN_TFTP_ERROR, "TFTP Error" },\r | |
49 | { RETURN_PROTOCOL_ERROR, "Protocol Error" },\r | |
50 | { RETURN_WARN_UNKNOWN_GLYPH, "Warning Unknown Glyph" },\r | |
51 | { RETURN_WARN_DELETE_FAILURE, "Warning Delete Failure" },\r | |
52 | { RETURN_WARN_WRITE_FAILURE, "Warning Write Failure" },\r | |
53 | { RETURN_WARN_BUFFER_TOO_SMALL, "Warning Buffer Too Small" },\r | |
54 | { 0, NULL }\r | |
55 | };\r | |
56 | \r | |
57 | \r | |
58 | /**\r | |
3f9f540d | 59 | Worker function that produces a Null-terminated string in an output buffer \r |
60 | based on a Null-terminated format string and a VA_LIST argument list.\r | |
61 | \r | |
878ddf1f | 62 | VSPrint function to process format and place the results in Buffer. Since a \r |
63 | VA_LIST is used this rountine allows the nesting of Vararg routines. Thus \r | |
64 | this is the main print working routine\r | |
65 | \r | |
3f9f540d | 66 | @param Buffer Character buffer to print the results of the parsing\r |
67 | of Format into.\r | |
68 | @param BufferSize Maximum number of characters to put into buffer.\r | |
3f9f540d | 69 | @param Flags Intial flags value.\r |
70 | Can only have FORMAT_UNICODE and OUTPUT_UNICODE set\r | |
71 | @param Format Null-terminated format string.\r | |
72 | @param Marker Vararg list consumed by processing Format.\r | |
878ddf1f | 73 | \r |
74 | @return Number of characters printed.\r | |
75 | \r | |
76 | **/\r | |
77 | UINTN\r | |
78 | BasePrintLibVSPrint (\r | |
79 | OUT CHAR8 *Buffer,\r | |
80 | IN UINTN BufferSize,\r | |
81 | IN UINTN Flags,\r | |
82 | IN CONST CHAR8 *Format,\r | |
83 | IN VA_LIST Marker\r | |
84 | )\r | |
85 | {\r | |
86 | CHAR8 *OriginalBuffer;\r | |
87 | CHAR8 ValueBuffer[MAXIMUM_VALUE_CHARACTERS];\r | |
88 | UINTN BytesPerOutputCharacter;\r | |
89 | UINTN BytesPerFormatCharacter;\r | |
90 | UINTN FormatMask;\r | |
91 | UINTN FormatCharacter;\r | |
92 | UINTN Width;\r | |
93 | UINTN Precision;\r | |
94 | INT64 Value;\r | |
95 | CHAR8 *ArgumentString;\r | |
96 | UINTN Character;\r | |
97 | GUID *TmpGuid;\r | |
98 | TIME *TmpTime;\r | |
99 | UINTN Count;\r | |
100 | UINTN ArgumentMask;\r | |
101 | INTN BytesPerArgumentCharacter;\r | |
102 | UINTN ArgumentCharacter;\r | |
103 | BOOLEAN Done;\r | |
104 | UINTN Index;\r | |
105 | CHAR8 Prefix;\r | |
106 | BOOLEAN ZeroPad;\r | |
107 | BOOLEAN Comma;\r | |
108 | UINTN Digits;\r | |
109 | UINTN Radix;\r | |
110 | RETURN_STATUS Status;\r | |
111 | \r | |
8960cdeb | 112 | if (BufferSize == 0) {\r |
113 | return 0;\r | |
114 | }\r | |
533f039e | 115 | ASSERT (Buffer != NULL);\r |
116 | ASSERT (Format != NULL);\r | |
117 | \r | |
878ddf1f | 118 | OriginalBuffer = Buffer;\r |
119 | \r | |
120 | if ((Flags & OUTPUT_UNICODE) != 0) {\r | |
121 | BytesPerOutputCharacter = 2;\r | |
122 | } else {\r | |
123 | BytesPerOutputCharacter = 1;\r | |
124 | }\r | |
125 | if ((Flags & FORMAT_UNICODE) != 0) {\r | |
126 | BytesPerFormatCharacter = 2;\r | |
127 | FormatMask = 0xffff;\r | |
128 | } else {\r | |
129 | BytesPerFormatCharacter = 1;\r | |
130 | FormatMask = 0xff;\r | |
131 | }\r | |
132 | \r | |
133 | //\r | |
134 | // Reserve space for the Null terminator.\r | |
878ddf1f | 135 | //\r |
136 | BufferSize--;\r | |
137 | \r | |
138 | //\r | |
139 | // Get the first character from the format string\r | |
140 | //\r | |
f76fd83e | 141 | FormatCharacter = (*Format | (*(Format + 1) << 8)) & FormatMask;\r |
878ddf1f | 142 | \r |
143 | //\r | |
144 | // Loop until the end of the format string is reached or the output buffer is full\r | |
145 | //\r | |
146 | while (FormatCharacter != 0 && BufferSize > 0) {\r | |
147 | //\r | |
148 | // Clear all the flag bits except those that may have been passed in\r | |
149 | //\r | |
150 | Flags &= (OUTPUT_UNICODE | FORMAT_UNICODE);\r | |
151 | \r | |
152 | //\r | |
153 | // Set the default width to zero, and the default precision to 1\r | |
154 | //\r | |
155 | Width = 0;\r | |
156 | Precision = 1;\r | |
157 | Prefix = 0;\r | |
158 | Comma = FALSE;\r | |
159 | ZeroPad = FALSE;\r | |
160 | Count = 0;\r | |
161 | Digits = 0;\r | |
162 | \r | |
163 | switch (FormatCharacter) {\r | |
164 | case '%':\r | |
165 | //\r | |
166 | // Parse Flags and Width\r | |
167 | //\r | |
168 | for (Done = FALSE; !Done; ) {\r | |
169 | Format += BytesPerFormatCharacter;\r | |
170 | FormatCharacter = (*Format | (*(Format + 1) << 8)) & FormatMask;\r | |
171 | switch (FormatCharacter) {\r | |
172 | case '.': \r | |
173 | Flags |= PRECISION; \r | |
174 | break;\r | |
175 | case '-': \r | |
176 | Flags |= LEFT_JUSTIFY; \r | |
177 | break;\r | |
178 | case '+': \r | |
179 | Flags |= PREFIX_SIGN; \r | |
180 | break;\r | |
181 | case ' ': \r | |
182 | Flags |= PREFIX_BLANK; \r | |
183 | break;\r | |
184 | case ',': \r | |
185 | Flags |= COMMA_TYPE; \r | |
186 | break;\r | |
187 | case 'L':\r | |
188 | case 'l': \r | |
189 | Flags |= LONG_TYPE; \r | |
190 | break;\r | |
191 | case '*':\r | |
192 | if ((Flags & PRECISION) == 0) {\r | |
193 | Flags |= PAD_TO_WIDTH;\r | |
194 | Width = VA_ARG (Marker, UINTN);\r | |
195 | } else {\r | |
196 | Precision = VA_ARG (Marker, UINTN);\r | |
197 | }\r | |
198 | break;\r | |
199 | case '0':\r | |
200 | if ((Flags & PRECISION) == 0) {\r | |
201 | Flags |= PREFIX_ZERO;\r | |
202 | }\r | |
203 | case '1':\r | |
204 | case '2':\r | |
205 | case '3':\r | |
206 | case '4':\r | |
207 | case '5':\r | |
208 | case '6':\r | |
209 | case '7':\r | |
210 | case '8':\r | |
211 | case '9':\r | |
212 | for (Count = 0; ((FormatCharacter >= '0') && (FormatCharacter <= '9')); ){\r | |
213 | Count = (Count * 10) + FormatCharacter - '0';\r | |
214 | Format += BytesPerFormatCharacter;\r | |
215 | FormatCharacter = (*Format | (*(Format + 1) << 8)) & FormatMask;\r | |
216 | }\r | |
217 | Format -= BytesPerFormatCharacter;\r | |
218 | if ((Flags & PRECISION) == 0) {\r | |
219 | Flags |= PAD_TO_WIDTH;\r | |
220 | Width = Count;\r | |
221 | } else {\r | |
222 | Precision = Count;\r | |
223 | }\r | |
224 | break;\r | |
225 | default:\r | |
226 | Done = TRUE;\r | |
227 | break;\r | |
228 | }\r | |
229 | } \r | |
230 | \r | |
231 | //\r | |
232 | // Limit the maximum field width to the remaining characters in the output buffer\r | |
233 | //\r | |
234 | if (Width > BufferSize) {\r | |
235 | Width = BufferSize;\r | |
236 | }\r | |
237 | \r | |
238 | //\r | |
239 | // Handle each argument type\r | |
240 | //\r | |
241 | switch (FormatCharacter) {\r | |
1d580c14 | 242 | case 'p':\r |
243 | if (sizeof (VOID *) > 4) {\r | |
244 | Flags |= LONG_TYPE;\r | |
245 | }\r | |
878ddf1f | 246 | case 'X':\r |
247 | Flags |= PREFIX_ZERO;\r | |
248 | //\r | |
249 | // break skiped on purpose\r | |
250 | //\r | |
251 | case 'x':\r | |
252 | Flags |= RADIX_HEX;\r | |
253 | //\r | |
254 | // break skiped on purpose\r | |
255 | //\r | |
256 | case 'd':\r | |
257 | if ((Flags & LONG_TYPE) == 0) {\r | |
1d580c14 | 258 | Value = (VA_ARG (Marker, int));\r |
878ddf1f | 259 | } else {\r |
260 | Value = VA_ARG (Marker, INT64);\r | |
261 | }\r | |
262 | if ((Flags & PREFIX_BLANK) != 0) {\r | |
263 | Prefix = ' ';\r | |
264 | }\r | |
265 | if ((Flags & PREFIX_SIGN) != 0) {\r | |
266 | Prefix = '+';\r | |
267 | }\r | |
268 | if ((Flags & COMMA_TYPE) != 0) {\r | |
269 | Comma = TRUE;\r | |
270 | }\r | |
271 | if ((Flags & RADIX_HEX) == 0) {\r | |
272 | Radix = 10;\r | |
273 | if (Comma) {\r | |
274 | Flags &= (~PREFIX_ZERO);\r | |
275 | Precision = 1;\r | |
276 | }\r | |
277 | if (Value < 0) {\r | |
278 | Flags |= PREFIX_SIGN;\r | |
279 | Prefix = '-';\r | |
280 | Value = -Value;\r | |
281 | }\r | |
282 | } else {\r | |
283 | Radix = 16;\r | |
284 | Comma = FALSE;\r | |
285 | if ((Flags & LONG_TYPE) == 0 && Value < 0) {\r | |
1d580c14 | 286 | Value = (unsigned int)Value;\r |
878ddf1f | 287 | }\r |
288 | }\r | |
289 | //\r | |
290 | // Convert Value to a reversed string\r | |
291 | //\r | |
292 | Count = BasePrintLibValueToString (ValueBuffer, Value, Radix);\r | |
293 | if (Value == 0 && Precision == 0) {\r | |
294 | Count = 0;\r | |
295 | }\r | |
296 | ArgumentString = (CHAR8 *)ValueBuffer + Count;\r | |
297 | Digits = 3 - (Count % 3);\r | |
298 | if (Comma && Count != 0) {\r | |
299 | Count += ((Count - 1) / 3);\r | |
300 | }\r | |
301 | if (Prefix != 0) {\r | |
302 | Count++;\r | |
303 | }\r | |
304 | Flags |= ARGUMENT_REVERSED;\r | |
305 | ZeroPad = TRUE;\r | |
306 | if ((Flags & PREFIX_ZERO) != 0) {\r | |
307 | if ((Flags & PAD_TO_WIDTH) != 0) {\r | |
308 | if ((Flags & PRECISION) == 0) {\r | |
309 | Precision = Width;\r | |
310 | }\r | |
311 | }\r | |
312 | }\r | |
313 | break;\r | |
314 | \r | |
315 | case 's':\r | |
316 | case 'S':\r | |
317 | Flags |= ARGUMENT_UNICODE;\r | |
318 | //\r | |
319 | // break skipped on purpose\r | |
320 | //\r | |
321 | case 'a':\r | |
322 | ArgumentString = (CHAR8 *)VA_ARG (Marker, CHAR8 *);\r | |
323 | if (ArgumentString == NULL) {\r | |
324 | Flags &= (~ARGUMENT_UNICODE);\r | |
325 | ArgumentString = "<null string>";\r | |
326 | }\r | |
327 | break;\r | |
328 | \r | |
329 | case 'c':\r | |
330 | Character = VA_ARG (Marker, UINTN) & 0xffff;\r | |
331 | ArgumentString = (CHAR8 *)&Character;\r | |
332 | Flags |= ARGUMENT_UNICODE;\r | |
333 | break;\r | |
334 | \r | |
335 | case 'g':\r | |
336 | TmpGuid = VA_ARG (Marker, GUID *);\r | |
337 | if (TmpGuid == NULL) {\r | |
338 | ArgumentString = "<null guid>";\r | |
339 | } else {\r | |
340 | BasePrintLibSPrint (\r | |
341 | ValueBuffer,\r | |
8960cdeb | 342 | MAXIMUM_VALUE_CHARACTERS, \r |
878ddf1f | 343 | 0,\r |
344 | "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",\r | |
f76fd83e | 345 | TmpGuid->Data1,\r |
346 | TmpGuid->Data2,\r | |
347 | TmpGuid->Data3,\r | |
348 | TmpGuid->Data4[0],\r | |
349 | TmpGuid->Data4[1],\r | |
350 | TmpGuid->Data4[2],\r | |
351 | TmpGuid->Data4[3],\r | |
352 | TmpGuid->Data4[4],\r | |
353 | TmpGuid->Data4[5],\r | |
354 | TmpGuid->Data4[6],\r | |
355 | TmpGuid->Data4[7]\r | |
878ddf1f | 356 | );\r |
357 | ArgumentString = ValueBuffer;\r | |
358 | }\r | |
359 | break;\r | |
360 | \r | |
361 | case 't':\r | |
362 | TmpTime = VA_ARG (Marker, TIME *); \r | |
363 | if (TmpTime == NULL) {\r | |
364 | ArgumentString = "<null time>";\r | |
365 | } else {\r | |
366 | BasePrintLibSPrint (\r | |
367 | ValueBuffer,\r | |
8960cdeb | 368 | MAXIMUM_VALUE_CHARACTERS,\r |
878ddf1f | 369 | 0,\r |
370 | "%02d/%02d/%04d %02d:%02d",\r | |
f76fd83e | 371 | TmpTime->Month,\r |
372 | TmpTime->Day,\r | |
373 | TmpTime->Year,\r | |
374 | TmpTime->Hour,\r | |
375 | TmpTime->Minute\r | |
878ddf1f | 376 | );\r |
377 | ArgumentString = ValueBuffer;\r | |
378 | }\r | |
379 | break;\r | |
380 | \r | |
381 | case 'r':\r | |
382 | Status = VA_ARG (Marker, RETURN_STATUS);\r | |
383 | ArgumentString = ValueBuffer;\r | |
384 | for (Index = 0; StatusString[Index].String != NULL; Index++) {\r | |
385 | if (Status == StatusString[Index].Status) {\r | |
386 | ArgumentString = StatusString[Index].String;\r | |
387 | }\r | |
388 | }\r | |
389 | if (ArgumentString == ValueBuffer) {\r | |
8960cdeb | 390 | BasePrintLibSPrint ((CHAR8 *) ValueBuffer, MAXIMUM_VALUE_CHARACTERS, 0, "%08X", Status);\r |
878ddf1f | 391 | }\r |
392 | break;\r | |
393 | \r | |
8960cdeb | 394 | case '\n':\r |
395 | ArgumentString = "\r\n";\r | |
396 | break;\r | |
397 | \r | |
878ddf1f | 398 | case '%':\r |
399 | default:\r | |
400 | //\r | |
401 | // if the type is '%' or unknown, then print it to the screen\r | |
402 | //\r | |
403 | ArgumentString = (CHAR8 *)&FormatCharacter;\r | |
404 | Flags |= ARGUMENT_UNICODE;\r | |
405 | break;\r | |
406 | }\r | |
407 | break;\r | |
878ddf1f | 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 | |
524 | \r | |
525 | return ((Buffer - OriginalBuffer) / BytesPerOutputCharacter);\r | |
526 | }\r | |
527 | \r | |
3f9f540d | 528 | /**\r |
529 | Worker function that produces a Null-terminated string in an output buffer \r | |
530 | based on a Null-terminated format string and variable argument list.\r | |
531 | \r | |
532 | VSPrint function to process format and place the results in Buffer. Since a \r | |
533 | VA_LIST is used this rountine allows the nesting of Vararg routines. Thus \r | |
534 | this is the main print working routine\r | |
535 | \r | |
536 | @param Buffer Character buffer to print the results of the parsing\r | |
537 | of Format into.\r | |
538 | @param BufferSize Maximum number of characters to put into buffer.\r | |
539 | Zero means no limit.\r | |
540 | @param Flags Intial flags value.\r | |
541 | Can only have FORMAT_UNICODE and OUTPUT_UNICODE set\r | |
542 | @param FormatString Null-terminated format string.\r | |
543 | \r | |
544 | @return Number of characters printed.\r | |
545 | \r | |
546 | **/\r | |
878ddf1f | 547 | UINTN\r |
548 | BasePrintLibSPrint (\r | |
549 | OUT CHAR8 *StartOfBuffer,\r | |
550 | IN UINTN BufferSize,\r | |
551 | IN UINTN Flags,\r | |
552 | IN CONST CHAR8 *FormatString,\r | |
553 | ...\r | |
554 | )\r | |
555 | {\r | |
556 | VA_LIST Marker;\r | |
557 | \r | |
558 | VA_START (Marker, FormatString);\r | |
559 | return BasePrintLibVSPrint (StartOfBuffer, BufferSize, Flags, FormatString, Marker);\r | |
560 | }\r | |
561 | \r | |
3f9f540d | 562 | /**\r |
563 | Produces a Null-terminated Unicode string in an output buffer based on \r | |
564 | a Null-terminated Unicode format string and a VA_LIST argument list\r | |
565 | \r | |
566 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
567 | and BufferSize. \r | |
568 | The Unicode string is produced by parsing the format string specified by FormatString. \r | |
569 | Arguments are pulled from the variable argument list specified by Marker based on the \r | |
570 | contents of the format string. \r | |
571 | The length of the produced output buffer is returned.\r | |
572 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
573 | \r | |
574 | If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().\r | |
575 | If BufferSize is not 0 and FormatString is NULL, then ASSERT().\r | |
576 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r | |
577 | PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().\r | |
578 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
579 | contains more than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().\r | |
580 | \r | |
581 | @param StartOfBuffer APointer to the output buffer for the produced Null-terminated \r | |
582 | Unicode string.\r | |
583 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
584 | @param FormatString Null-terminated Unicode format string.\r | |
585 | @param Marker VA_LIST marker for the variable argument list.\r | |
586 | \r | |
587 | @return return Length of the produced output buffer.\r | |
588 | \r | |
589 | **/\r | |
878ddf1f | 590 | UINTN\r |
591 | EFIAPI\r | |
592 | UnicodeVSPrint (\r | |
593 | OUT CHAR16 *StartOfBuffer,\r | |
594 | IN UINTN BufferSize,\r | |
595 | IN CONST CHAR16 *FormatString,\r | |
596 | IN VA_LIST Marker\r | |
597 | )\r | |
598 | {\r | |
599 | return BasePrintLibVSPrint ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, Marker);\r | |
600 | }\r | |
601 | \r | |
3f9f540d | 602 | /**\r |
603 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r | |
604 | Unicode format string and variable argument list.\r | |
605 | \r | |
606 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
607 | and BufferSize.\r | |
608 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
609 | Arguments are pulled from the variable argument list based on the contents of the format string.\r | |
610 | The length of the produced output buffer is returned. \r | |
611 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
612 | \r | |
613 | If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().\r | |
614 | If BufferSize is not 0 and FormatString is NULL, then ASSERT().\r | |
615 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r | |
616 | PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().\r | |
617 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
618 | contains more than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().\r | |
619 | \r | |
620 | @param StartOfBuffer APointer to the output buffer for the produced Null-terminated \r | |
621 | Unicode string.\r | |
622 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
623 | @param FormatString Null-terminated Unicode format string.\r | |
624 | \r | |
625 | @return Length of the produced output buffer.\r | |
626 | \r | |
627 | **/\r | |
878ddf1f | 628 | UINTN\r |
629 | EFIAPI\r | |
630 | UnicodeSPrint (\r | |
631 | OUT CHAR16 *StartOfBuffer,\r | |
632 | IN UINTN BufferSize,\r | |
633 | IN CONST CHAR16 *FormatString,\r | |
634 | ...\r | |
635 | )\r | |
636 | {\r | |
637 | VA_LIST Marker;\r | |
638 | \r | |
639 | VA_START (Marker, FormatString);\r | |
640 | return UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r | |
641 | }\r | |
642 | \r | |
3f9f540d | 643 | /**\r |
644 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r | |
645 | ASCII format string and a VA_LIST argument list\r | |
646 | \r | |
647 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
648 | and BufferSize.\r | |
649 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
650 | Arguments are pulled from the variable argument list specified by Marker based on the \r | |
651 | contents of the format string.\r | |
652 | The length of the produced output buffer is returned.\r | |
653 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
654 | \r | |
655 | If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().\r | |
656 | If BufferSize is not 0 and FormatString is NULL, then ASSERT().\r | |
657 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r | |
658 | PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().\r | |
659 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
660 | contains more than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().\r | |
661 | \r | |
662 | @param StartOfBuffer APointer to the output buffer for the produced Null-terminated \r | |
663 | Unicode string.\r | |
664 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
665 | @param FormatString Null-terminated Unicode format string.\r | |
666 | @param Marker VA_LIST marker for the variable argument list.\r | |
667 | \r | |
668 | @return Length of the produced output buffer.\r | |
669 | \r | |
670 | **/\r | |
878ddf1f | 671 | UINTN\r |
672 | EFIAPI\r | |
673 | UnicodeVSPrintAsciiFormat (\r | |
674 | OUT CHAR16 *StartOfBuffer,\r | |
675 | IN UINTN BufferSize,\r | |
676 | IN CONST CHAR8 *FormatString,\r | |
677 | IN VA_LIST Marker\r | |
678 | )\r | |
679 | {\r | |
680 | return BasePrintLibVSPrint ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE,FormatString, Marker);\r | |
681 | }\r | |
682 | \r | |
3f9f540d | 683 | /**\r |
684 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r | |
685 | ASCII format string and variable argument list.\r | |
686 | \r | |
687 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
688 | and BufferSize.\r | |
689 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
690 | Arguments are pulled from the variable argument list based on the contents of the \r | |
691 | format string.\r | |
692 | The length of the produced output buffer is returned.\r | |
693 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
694 | \r | |
695 | If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().\r | |
696 | If BufferSize is not 0 and FormatString is NULL, then ASSERT().\r | |
697 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r | |
698 | PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().\r | |
699 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
700 | contains more than PcdMaximumUnicodeStringLength Unicode characters, then ASSERT().\r | |
701 | \r | |
702 | @param StartOfBuffer APointer to the output buffer for the produced Null-terminated \r | |
703 | Unicode string.\r | |
704 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
705 | @param FormatString Null-terminated Unicode format string.\r | |
706 | \r | |
707 | @return Length of the produced output buffer.\r | |
708 | \r | |
709 | **/\r | |
878ddf1f | 710 | UINTN\r |
711 | EFIAPI\r | |
712 | UnicodeSPrintAsciiFormat (\r | |
713 | OUT CHAR16 *StartOfBuffer,\r | |
714 | IN UINTN BufferSize,\r | |
715 | IN CONST CHAR8 *FormatString,\r | |
716 | ...\r | |
717 | )\r | |
718 | {\r | |
719 | VA_LIST Marker;\r | |
720 | \r | |
721 | VA_START (Marker, FormatString);\r | |
8960cdeb | 722 | return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r |
878ddf1f | 723 | }\r |
724 | \r | |
3f9f540d | 725 | /**\r |
726 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
727 | ASCII format string and a VA_LIST argument list.\r | |
728 | \r | |
729 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
730 | and BufferSize.\r | |
731 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
732 | Arguments are pulled from the variable argument list specified by Marker based on \r | |
733 | the contents of the format string.\r | |
734 | The length of the produced output buffer is returned.\r | |
735 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
736 | \r | |
737 | If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().\r | |
738 | If BufferSize is not 0 and FormatString is NULL, then ASSERT().\r | |
739 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r | |
740 | PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().\r | |
741 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
742 | contains more than PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().\r | |
743 | \r | |
744 | @param StartOfBuffer APointer to the output buffer for the produced Null-terminated \r | |
745 | ASCII string.\r | |
746 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
747 | @param FormatString Null-terminated Unicode format string.\r | |
748 | @param Marker VA_LIST marker for the variable argument list.\r | |
749 | \r | |
750 | @return Length of the produced output buffer.\r | |
751 | \r | |
752 | **/\r | |
878ddf1f | 753 | UINTN\r |
754 | EFIAPI\r | |
755 | AsciiVSPrint (\r | |
756 | OUT CHAR8 *StartOfBuffer,\r | |
757 | IN UINTN BufferSize,\r | |
758 | IN CONST CHAR8 *FormatString,\r | |
759 | IN VA_LIST Marker\r | |
760 | )\r | |
761 | {\r | |
762 | return BasePrintLibVSPrint (StartOfBuffer, BufferSize, 0, FormatString, Marker);\r | |
763 | }\r | |
764 | \r | |
3f9f540d | 765 | /**\r |
766 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
767 | ASCII format string and variable argument list.\r | |
768 | \r | |
769 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
770 | and BufferSize.\r | |
771 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
772 | Arguments are pulled from the variable argument list based on the contents of the \r | |
773 | format string.\r | |
774 | The length of the produced output buffer is returned.\r | |
775 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
776 | \r | |
777 | If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().\r | |
778 | If BufferSize is not 0 and FormatString is NULL, then ASSERT().\r | |
779 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r | |
780 | PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().\r | |
781 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
782 | contains more than PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().\r | |
783 | \r | |
784 | @param StartOfBuffer APointer to the output buffer for the produced Null-terminated \r | |
785 | ASCII string.\r | |
786 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
787 | @param FormatString Null-terminated Unicode format string.\r | |
788 | \r | |
789 | @return Length of the produced output buffer.\r | |
790 | \r | |
791 | **/\r | |
878ddf1f | 792 | UINTN\r |
793 | EFIAPI\r | |
794 | AsciiSPrint (\r | |
795 | OUT CHAR8 *StartOfBuffer,\r | |
796 | IN UINTN BufferSize,\r | |
797 | IN CONST CHAR8 *FormatString,\r | |
798 | ...\r | |
799 | )\r | |
800 | {\r | |
801 | VA_LIST Marker;\r | |
802 | \r | |
803 | VA_START (Marker, FormatString);\r | |
804 | return AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r | |
805 | }\r | |
806 | \r | |
3f9f540d | 807 | /**\r |
808 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
809 | ASCII format string and a VA_LIST argument list.\r | |
810 | \r | |
811 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
812 | and BufferSize.\r | |
813 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
814 | Arguments are pulled from the variable argument list specified by Marker based on \r | |
815 | the contents of the format string.\r | |
816 | The length of the produced output buffer is returned.\r | |
817 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
818 | \r | |
819 | If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().\r | |
820 | If BufferSize is not 0 and FormatString is NULL, then ASSERT().\r | |
821 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r | |
822 | PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().\r | |
823 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
824 | contains more than PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().\r | |
825 | \r | |
826 | @param StartOfBuffer APointer to the output buffer for the produced Null-terminated \r | |
827 | ASCII string.\r | |
828 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
829 | @param FormatString Null-terminated Unicode format string.\r | |
830 | @param Marker VA_LIST marker for the variable argument list.\r | |
831 | \r | |
832 | @return Length of the produced output buffer.\r | |
833 | \r | |
834 | **/\r | |
878ddf1f | 835 | UINTN\r |
836 | EFIAPI\r | |
837 | AsciiVSPrintUnicodeFormat (\r | |
838 | OUT CHAR8 *StartOfBuffer,\r | |
839 | IN UINTN BufferSize,\r | |
840 | IN CONST CHAR16 *FormatString,\r | |
841 | IN VA_LIST Marker\r | |
842 | )\r | |
843 | {\r | |
844 | return BasePrintLibVSPrint (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, Marker);\r | |
845 | }\r | |
846 | \r | |
3f9f540d | 847 | /**\r |
848 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
849 | ASCII format string and variable argument list.\r | |
850 | \r | |
851 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
852 | and BufferSize.\r | |
853 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
854 | Arguments are pulled from the variable argument list based on the contents of the \r | |
855 | format string.\r | |
856 | The length of the produced output buffer is returned.\r | |
857 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
858 | \r | |
859 | If BufferSize is not 0 and StartOfBuffer is NULL, then ASSERT().\r | |
860 | If BufferSize is not 0 and FormatString is NULL, then ASSERT().\r | |
861 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r | |
862 | PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().\r | |
863 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
864 | contains more than PcdMaximumUnicodeStringLength ASCII characters, then ASSERT().\r | |
865 | \r | |
866 | @param StartOfBuffer APointer to the output buffer for the produced Null-terminated \r | |
867 | ASCII string.\r | |
868 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
869 | @param FormatString Null-terminated Unicode format string.\r | |
870 | \r | |
871 | @return Length of the produced output buffer.\r | |
872 | \r | |
873 | **/\r | |
878ddf1f | 874 | UINTN\r |
875 | EFIAPI\r | |
876 | AsciiSPrintUnicodeFormat (\r | |
877 | OUT CHAR8 *StartOfBuffer,\r | |
878 | IN UINTN BufferSize,\r | |
879 | IN CONST CHAR16 *FormatString,\r | |
880 | ...\r | |
881 | )\r | |
882 | {\r | |
883 | VA_LIST Marker;\r | |
884 | \r | |
885 | VA_START (Marker, FormatString);\r | |
886 | return AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r | |
887 | }\r | |
a3657e3e | 888 | \r |
3f9f540d | 889 | /**\r |
890 | Converts a decimal value to a Null-terminated Unicode string.\r | |
891 | \r | |
892 | Converts the decimal number specified by Value to a Null-terminated Unicode \r | |
893 | string specified by Buffer containing at most Width characters.\r | |
894 | If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r | |
895 | The total number of characters placed in Buffer is returned.\r | |
896 | If the conversion contains more than Width characters, then only the first\r | |
897 | Width characters are returned, and the total number of characters \r | |
898 | required to perform the conversion is returned.\r | |
899 | Additional conversion parameters are specified in Flags. \r | |
900 | The Flags bit LEFT_JUSTIFY is always ignored.\r | |
901 | All conversions are left justified in Buffer.\r | |
902 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
903 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r | |
904 | are inserted every 3rd digit starting from the right.\r | |
905 | If Value is < 0, then the fist character in Buffer is a '-'.\r | |
906 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r | |
907 | then Buffer is padded with '0' characters so the combination of the optional '-' \r | |
908 | sign character, '0' characters, digit characters for Value, and the Null-terminator\r | |
909 | add up to Width characters.\r | |
910 | \r | |
911 | If Buffer is NULL, then ASSERT().\r | |
912 | If unsupported bits are set in Flags, then ASSERT().\r | |
913 | If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r | |
914 | \r | |
915 | @param Buffer Pointer to the output buffer for the produced Null-terminated\r | |
916 | Unicode string.\r | |
917 | @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r | |
918 | @param Value The 64-bit signed value to convert to a string.\r | |
919 | @param Width The maximum number of Unicode characters to place in Buffer.\r | |
920 | \r | |
921 | @return Total number of characters required to perform the conversion.\r | |
922 | \r | |
923 | **/\r | |
a3657e3e | 924 | UINTN\r |
925 | EFIAPI\r | |
926 | UnicodeValueToString (\r | |
927 | IN OUT CHAR16 *Buffer,\r | |
928 | IN UINTN Flags,\r | |
929 | IN INT64 Value,\r | |
930 | IN UINTN Width\r | |
931 | )\r | |
932 | {\r | |
933 | return BasePrintLibConvertValueToString ((CHAR8 *)Buffer, Flags, Value, Width, 2);\r | |
934 | }\r | |
935 | \r | |
3f9f540d | 936 | /**\r |
937 | Converts a decimal value to a Null-terminated ASCII string.\r | |
938 | \r | |
939 | Converts the decimal number specified by Value to a Null-terminated ASCII string \r | |
940 | specified by Buffer containing at most Width characters.\r | |
941 | If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r | |
942 | The total number of characters placed in Buffer is returned.\r | |
943 | If the conversion contains more than Width characters, then only the first Width\r | |
944 | characters are returned, and the total number of characters required to perform\r | |
945 | the conversion is returned.\r | |
946 | Additional conversion parameters are specified in Flags. \r | |
947 | The Flags bit LEFT_JUSTIFY is always ignored.\r | |
948 | All conversions are left justified in Buffer.\r | |
949 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
950 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas \r | |
951 | are inserted every 3rd digit starting from the right.\r | |
952 | If Value is < 0, then the fist character in Buffer is a '-'.\r | |
953 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then Buffer\r | |
954 | is padded with '0' characters so the combination of the optional '-'\r | |
955 | sign character, '0' characters, digit characters for Value, and the \r | |
956 | Null-terminator add up to Width characters.\r | |
957 | \r | |
958 | If Buffer is NULL, then ASSERT().\r | |
959 | If unsupported bits are set in Flags, then ASSERT().\r | |
960 | If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r | |
961 | \r | |
962 | @param Buffer Pointer to the output buffer for the produced Null-terminated\r | |
963 | ASCII string.\r | |
964 | @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r | |
965 | @param Value The 64-bit signed value to convert to a string.\r | |
966 | @param Width The maximum number of ASCII characters to place in Buffer.\r | |
967 | \r | |
968 | @return Total number of characters required to perform the conversion.\r | |
969 | \r | |
970 | **/\r | |
a3657e3e | 971 | UINTN\r |
972 | EFIAPI\r | |
973 | AsciiValueToString (\r | |
974 | IN OUT CHAR8 *Buffer,\r | |
975 | IN UINTN Flags,\r | |
976 | IN INT64 Value,\r | |
977 | IN UINTN Width\r | |
978 | )\r | |
979 | {\r | |
980 | return BasePrintLibConvertValueToString ((CHAR8 *)Buffer, Flags, Value, Width, 1);\r | |
981 | }\r |