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