]>
Commit | Line | Data |
---|---|---|
504214c4 | 1 | /** @file\r |
bee67555 | 2 | Instance of Print Library based on gEfiPrint2ProtocolGuid.\r |
a0afd019 | 3 | \r |
504214c4 | 4 | Implement the print library instance by wrap the interface \r |
bee67555 | 5 | provided in the Print2 protocol. This protocol is defined as the internal\r |
504214c4 LG |
6 | protocol related to this implementation, not in the public spec. So, this \r |
7 | library instance is only for this code base.\r | |
8 | \r | |
bee67555 | 9 | Copyright (c) 2009, Intel Corporation\r |
a0afd019 | 10 | All rights reserved. This program and the accompanying materials\r |
11 | are licensed and made available under the terms and conditions of the BSD License\r | |
12 | which accompanies this distribution. The full text of the license may be found at\r | |
13 | http://opensource.org/licenses/bsd-license.php\r | |
14 | \r | |
15 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
16 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
17 | \r | |
504214c4 | 18 | **/\r |
a0afd019 | 19 | \r |
60c93673 | 20 | #include <Uefi.h>\r |
0ed0c867 | 21 | #include <Protocol/Print2.h>\r |
a0afd019 | 22 | #include <Library/UefiBootServicesTableLib.h>\r |
bee67555 | 23 | #include <Library/DebugLib.h>\r |
a0afd019 | 24 | \r |
bee67555 | 25 | EFI_PRINT2_PROTOCOL *mPrint2Protocol = NULL;\r |
a0afd019 | 26 | \r |
ce95aa7a | 27 | /**\r |
bee67555 | 28 | The constructor function caches the pointer to Print2 protocol.\r |
29 | \r | |
30 | The constructor function locates Print2 protocol from protocol database.\r | |
31 | It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. \r | |
ce95aa7a | 32 | \r |
bee67555 | 33 | @param ImageHandle The firmware allocated handle for the EFI image.\r |
34 | @param SystemTable A pointer to the EFI System Table.\r | |
35 | \r | |
36 | @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r | |
ce95aa7a | 37 | \r |
38 | **/\r | |
2ad4dad0 LG |
39 | EFI_STATUS\r |
40 | EFIAPI\r | |
bee67555 | 41 | PrintLibConstructor (\r |
42 | IN EFI_HANDLE ImageHandle,\r | |
43 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
a0afd019 | 44 | )\r |
a0afd019 | 45 | {\r |
bee67555 | 46 | EFI_STATUS Status;\r |
47 | \r | |
48 | Status = gBS->LocateProtocol (\r | |
49 | &gEfiPrint2ProtocolGuid,\r | |
50 | NULL,\r | |
51 | (VOID**) &mPrint2Protocol\r | |
52 | );\r | |
53 | ASSERT_EFI_ERROR (Status);\r | |
54 | ASSERT (mPrint2Protocol != NULL);\r | |
55 | \r | |
56 | return Status;\r | |
2ad4dad0 LG |
57 | }\r |
58 | \r | |
bee67555 | 59 | \r |
2ad4dad0 LG |
60 | /**\r |
61 | Produces a Null-terminated Unicode string in an output buffer based on \r | |
62 | a Null-terminated Unicode format string and a VA_LIST argument list\r | |
63 | \r | |
64 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
65 | and BufferSize. \r | |
66 | The Unicode string is produced by parsing the format string specified by FormatString. \r | |
67 | Arguments are pulled from the variable argument list specified by Marker based on the \r | |
68 | contents of the format string. \r | |
69 | The number of Unicode characters in the produced output buffer is returned not including\r | |
70 | the Null-terminator.\r | |
71 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r | |
72 | \r | |
73 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r | |
74 | If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
75 | If BufferSize > 1 and FormatString is NULL, then ASSERT().\r | |
76 | If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
77 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r | |
78 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
79 | ASSERT().\r | |
80 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
81 | contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
82 | Null-terminator, then ASSERT().\r | |
83 | \r | |
84 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
85 | Unicode string.\r | |
86 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
87 | @param FormatString Null-terminated Unicode format string.\r | |
88 | @param Marker VA_LIST marker for the variable argument list.\r | |
89 | \r | |
90 | @return The number of Unicode characters in the produced output buffer not including the\r | |
91 | Null-terminator.\r | |
92 | \r | |
93 | **/\r | |
94 | UINTN\r | |
95 | EFIAPI\r | |
96 | UnicodeVSPrint (\r | |
97 | OUT CHAR16 *StartOfBuffer,\r | |
98 | IN UINTN BufferSize,\r | |
99 | IN CONST CHAR16 *FormatString,\r | |
100 | IN VA_LIST Marker\r | |
101 | )\r | |
102 | {\r | |
bee67555 | 103 | return mPrint2Protocol->UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r |
a0afd019 | 104 | }\r |
105 | \r | |
2ad4dad0 LG |
106 | /**\r |
107 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r | |
108 | Unicode format string and variable argument list.\r | |
109 | \r | |
110 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
111 | and BufferSize.\r | |
112 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
113 | Arguments are pulled from the variable argument list based on the contents of the format string.\r | |
114 | The number of Unicode characters in the produced output buffer is returned not including\r | |
115 | the Null-terminator.\r | |
116 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r | |
117 | \r | |
118 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r | |
119 | If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
120 | If BufferSize > 1 and FormatString is NULL, then ASSERT().\r | |
121 | If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
122 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r | |
123 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
124 | ASSERT().\r | |
125 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
126 | contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
127 | Null-terminator, then ASSERT().\r | |
128 | \r | |
129 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
130 | Unicode string.\r | |
131 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
132 | @param FormatString Null-terminated Unicode format string.\r | |
71898234 | 133 | @param ... Variable argument list whose contents are accessed based on the \r |
134 | format string specified by FormatString.\r | |
ce95aa7a | 135 | \r |
2ad4dad0 LG |
136 | @return The number of Unicode characters in the produced output buffer not including the\r |
137 | Null-terminator.\r | |
138 | \r | |
139 | **/\r | |
a0afd019 | 140 | UINTN\r |
2ad4dad0 | 141 | EFIAPI\r |
a0afd019 | 142 | UnicodeSPrint (\r |
143 | OUT CHAR16 *StartOfBuffer,\r | |
144 | IN UINTN BufferSize,\r | |
2ad4dad0 | 145 | IN CONST CHAR16 *FormatString,\r |
a0afd019 | 146 | ...\r |
147 | )\r | |
a0afd019 | 148 | {\r |
2ad4dad0 | 149 | VA_LIST Marker;\r |
a0afd019 | 150 | \r |
151 | VA_START (Marker, FormatString);\r | |
2ad4dad0 | 152 | return UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r |
a0afd019 | 153 | }\r |
154 | \r | |
2ad4dad0 LG |
155 | /**\r |
156 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r | |
157 | ASCII format string and a VA_LIST argument list\r | |
158 | \r | |
159 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
160 | and BufferSize.\r | |
161 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
162 | Arguments are pulled from the variable argument list specified by Marker based on the \r | |
163 | contents of the format string.\r | |
164 | The number of Unicode characters in the produced output buffer is returned not including\r | |
165 | the Null-terminator.\r | |
166 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r | |
167 | \r | |
168 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r | |
169 | If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
170 | If BufferSize > 1 and FormatString is NULL, then ASSERT().\r | |
171 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r | |
172 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r | |
173 | ASSERT().\r | |
174 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
175 | contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
176 | Null-terminator, then ASSERT().\r | |
177 | \r | |
178 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
179 | Unicode string.\r | |
180 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
181 | @param FormatString Null-terminated Unicode format string.\r | |
182 | @param Marker VA_LIST marker for the variable argument list.\r | |
183 | \r | |
184 | @return The number of Unicode characters in the produced output buffer not including the\r | |
185 | Null-terminator.\r | |
186 | \r | |
187 | **/\r | |
a0afd019 | 188 | UINTN\r |
2ad4dad0 LG |
189 | EFIAPI\r |
190 | UnicodeVSPrintAsciiFormat (\r | |
191 | OUT CHAR16 *StartOfBuffer,\r | |
192 | IN UINTN BufferSize,\r | |
193 | IN CONST CHAR8 *FormatString,\r | |
194 | IN VA_LIST Marker\r | |
a0afd019 | 195 | )\r |
2ad4dad0 | 196 | {\r |
bee67555 | 197 | return mPrint2Protocol->UnicodeSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r |
2ad4dad0 | 198 | }\r |
a0afd019 | 199 | \r |
2ad4dad0 LG |
200 | /**\r |
201 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r | |
202 | ASCII format string and variable argument list.\r | |
203 | \r | |
204 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
205 | and BufferSize.\r | |
206 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
207 | Arguments are pulled from the variable argument list based on the contents of the \r | |
208 | format string.\r | |
209 | The number of Unicode characters in the produced output buffer is returned not including\r | |
210 | the Null-terminator.\r | |
211 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r | |
212 | \r | |
213 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r | |
214 | If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
215 | If BufferSize > 1 and FormatString is NULL, then ASSERT().\r | |
216 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r | |
217 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r | |
218 | ASSERT().\r | |
219 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
220 | contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
221 | Null-terminator, then ASSERT().\r | |
222 | \r | |
223 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
224 | Unicode string.\r | |
225 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
226 | @param FormatString Null-terminated Unicode format string.\r | |
71898234 | 227 | @param ... Variable argument list whose contents are accessed based on the \r |
228 | format string specified by FormatString.\r | |
2ad4dad0 LG |
229 | \r |
230 | @return The number of Unicode characters in the produced output buffer not including the\r | |
231 | Null-terminator.\r | |
232 | \r | |
233 | **/\r | |
234 | UINTN\r | |
235 | EFIAPI\r | |
236 | UnicodeSPrintAsciiFormat (\r | |
237 | OUT CHAR16 *StartOfBuffer,\r | |
238 | IN UINTN BufferSize,\r | |
239 | IN CONST CHAR8 *FormatString,\r | |
240 | ...\r | |
241 | )\r | |
242 | {\r | |
243 | VA_LIST Marker;\r | |
a0afd019 | 244 | \r |
2ad4dad0 LG |
245 | VA_START (Marker, FormatString);\r |
246 | return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r | |
247 | }\r | |
a0afd019 | 248 | \r |
2ad4dad0 LG |
249 | /**\r |
250 | Converts a decimal value to a Null-terminated Unicode string.\r | |
251 | \r | |
252 | Converts the decimal number specified by Value to a Null-terminated Unicode \r | |
253 | string specified by Buffer containing at most Width characters. No padding of spaces \r | |
254 | is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r | |
255 | The number of Unicode characters in Buffer is returned not including the Null-terminator.\r | |
256 | If the conversion contains more than Width characters, then only the first\r | |
257 | Width characters are returned, and the total number of characters \r | |
258 | required to perform the conversion is returned.\r | |
259 | Additional conversion parameters are specified in Flags. \r | |
260 | \r | |
261 | The Flags bit LEFT_JUSTIFY is always ignored.\r | |
262 | All conversions are left justified in Buffer.\r | |
263 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
264 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r | |
265 | are inserted every 3rd digit starting from the right.\r | |
266 | If HEX_RADIX is set in Flags, then the output buffer will be \r | |
267 | formatted in hexadecimal format.\r | |
268 | If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.\r | |
269 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r | |
270 | then Buffer is padded with '0' characters so the combination of the optional '-' \r | |
271 | sign character, '0' characters, digit characters for Value, and the Null-terminator\r | |
272 | add up to Width characters.\r | |
273 | If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r | |
274 | If Buffer is NULL, then ASSERT().\r | |
275 | If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
276 | If unsupported bits are set in Flags, then ASSERT().\r | |
277 | If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r | |
278 | If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r | |
279 | \r | |
280 | @param Buffer Pointer to the output buffer for the produced Null-terminated\r | |
281 | Unicode string.\r | |
282 | @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r | |
283 | @param Value The 64-bit signed value to convert to a string.\r | |
284 | @param Width The maximum number of Unicode characters to place in Buffer, not including\r | |
285 | the Null-terminator.\r | |
286 | \r | |
287 | @return The number of Unicode characters in Buffer not including the Null-terminator.\r | |
288 | \r | |
289 | **/\r | |
290 | UINTN\r | |
291 | EFIAPI\r | |
292 | UnicodeValueToString (\r | |
293 | IN OUT CHAR16 *Buffer,\r | |
294 | IN UINTN Flags,\r | |
295 | IN INT64 Value,\r | |
296 | IN UINTN Width\r | |
297 | )\r | |
298 | {\r | |
bee67555 | 299 | return mPrint2Protocol->UnicodeValueToString (Buffer, Flags, Value, Width);\r |
2ad4dad0 | 300 | }\r |
a0afd019 | 301 | \r |
2ad4dad0 LG |
302 | /**\r |
303 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
304 | ASCII format string and a VA_LIST argument list.\r | |
305 | \r | |
306 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
307 | and BufferSize.\r | |
308 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
309 | Arguments are pulled from the variable argument list specified by Marker based on \r | |
310 | the contents of the format string.\r | |
311 | The number of ASCII characters in the produced output buffer is returned not including\r | |
312 | the Null-terminator.\r | |
313 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
314 | \r | |
315 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r | |
316 | If BufferSize > 0 and FormatString is NULL, then ASSERT().\r | |
317 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r | |
318 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r | |
319 | ASSERT().\r | |
320 | If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r | |
321 | contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
322 | Null-terminator, then ASSERT().\r | |
323 | \r | |
324 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
325 | ASCII string.\r | |
326 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
327 | @param FormatString Null-terminated Unicode format string.\r | |
328 | @param Marker VA_LIST marker for the variable argument list.\r | |
329 | \r | |
330 | @return The number of ASCII characters in the produced output buffer not including the\r | |
331 | Null-terminator.\r | |
332 | \r | |
333 | **/\r | |
334 | UINTN\r | |
335 | EFIAPI\r | |
336 | AsciiVSPrint (\r | |
337 | OUT CHAR8 *StartOfBuffer,\r | |
338 | IN UINTN BufferSize,\r | |
339 | IN CONST CHAR8 *FormatString,\r | |
340 | IN VA_LIST Marker\r | |
341 | )\r | |
a0afd019 | 342 | {\r |
bee67555 | 343 | return mPrint2Protocol->AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r |
a0afd019 | 344 | }\r |
345 | \r | |
2ad4dad0 LG |
346 | /**\r |
347 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
348 | ASCII format string and variable argument list.\r | |
349 | \r | |
350 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
351 | and BufferSize.\r | |
352 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
353 | Arguments are pulled from the variable argument list based on the contents of the \r | |
354 | format string.\r | |
355 | The number of ASCII characters in the produced output buffer is returned not including\r | |
356 | the Null-terminator.\r | |
357 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
358 | \r | |
359 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r | |
360 | If BufferSize > 0 and FormatString is NULL, then ASSERT().\r | |
361 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r | |
362 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r | |
363 | ASSERT().\r | |
364 | If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r | |
365 | contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
366 | Null-terminator, then ASSERT().\r | |
367 | \r | |
368 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
369 | ASCII string.\r | |
370 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
371 | @param FormatString Null-terminated Unicode format string.\r | |
71898234 | 372 | @param ... Variable argument list whose contents are accessed based on the \r |
373 | format string specified by FormatString.\r | |
ce95aa7a | 374 | \r |
2ad4dad0 LG |
375 | @return The number of ASCII characters in the produced output buffer not including the\r |
376 | Null-terminator.\r | |
377 | \r | |
378 | **/\r | |
a0afd019 | 379 | UINTN\r |
2ad4dad0 | 380 | EFIAPI\r |
a0afd019 | 381 | AsciiSPrint (\r |
382 | OUT CHAR8 *StartOfBuffer,\r | |
383 | IN UINTN BufferSize,\r | |
2ad4dad0 | 384 | IN CONST CHAR8 *FormatString,\r |
a0afd019 | 385 | ...\r |
386 | )\r | |
2ad4dad0 LG |
387 | {\r |
388 | VA_LIST Marker;\r | |
389 | \r | |
390 | VA_START (Marker, FormatString);\r | |
391 | return AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r | |
392 | }\r | |
a0afd019 | 393 | \r |
2ad4dad0 LG |
394 | /**\r |
395 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
396 | ASCII format string and a VA_LIST argument list.\r | |
397 | \r | |
398 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
399 | and BufferSize.\r | |
400 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
401 | Arguments are pulled from the variable argument list specified by Marker based on \r | |
402 | the contents of the format string.\r | |
403 | The number of ASCII characters in the produced output buffer is returned not including\r | |
404 | the Null-terminator.\r | |
405 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
406 | \r | |
407 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r | |
408 | If BufferSize > 0 and FormatString is NULL, then ASSERT().\r | |
409 | If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
410 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r | |
411 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
412 | ASSERT().\r | |
413 | If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r | |
414 | contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
415 | Null-terminator, then ASSERT().\r | |
416 | \r | |
417 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
418 | ASCII string.\r | |
419 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
420 | @param FormatString Null-terminated Unicode format string.\r | |
421 | @param Marker VA_LIST marker for the variable argument list.\r | |
422 | \r | |
423 | @return The number of ASCII characters in the produced output buffer not including the\r | |
424 | Null-terminator.\r | |
425 | \r | |
426 | **/\r | |
427 | UINTN\r | |
428 | EFIAPI\r | |
429 | AsciiVSPrintUnicodeFormat (\r | |
430 | OUT CHAR8 *StartOfBuffer,\r | |
431 | IN UINTN BufferSize,\r | |
432 | IN CONST CHAR16 *FormatString,\r | |
433 | IN VA_LIST Marker\r | |
434 | )\r | |
a0afd019 | 435 | {\r |
bee67555 | 436 | return mPrint2Protocol->AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r |
2ad4dad0 LG |
437 | }\r |
438 | \r | |
439 | /**\r | |
440 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
441 | ASCII format string and variable argument list.\r | |
442 | \r | |
443 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
444 | and BufferSize.\r | |
445 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
446 | Arguments are pulled from the variable argument list based on the contents of the \r | |
447 | format string.\r | |
448 | The number of ASCII characters in the produced output buffer is returned not including\r | |
449 | the Null-terminator.\r | |
450 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
451 | \r | |
452 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r | |
453 | If BufferSize > 0 and FormatString is NULL, then ASSERT().\r | |
454 | If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
455 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r | |
456 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
457 | ASSERT().\r | |
458 | If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r | |
459 | contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
460 | Null-terminator, then ASSERT().\r | |
461 | \r | |
462 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
463 | ASCII string.\r | |
464 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
465 | @param FormatString Null-terminated Unicode format string.\r | |
71898234 | 466 | @param ... Variable argument list whose contents are accessed based on the \r |
467 | format string specified by FormatString.\r | |
ce95aa7a | 468 | \r |
2ad4dad0 LG |
469 | @return The number of ASCII characters in the produced output buffer not including the\r |
470 | Null-terminator.\r | |
471 | \r | |
472 | **/\r | |
473 | UINTN\r | |
474 | EFIAPI\r | |
475 | AsciiSPrintUnicodeFormat (\r | |
476 | OUT CHAR8 *StartOfBuffer,\r | |
477 | IN UINTN BufferSize,\r | |
478 | IN CONST CHAR16 *FormatString,\r | |
479 | ...\r | |
480 | )\r | |
481 | {\r | |
482 | VA_LIST Marker;\r | |
a0afd019 | 483 | \r |
484 | VA_START (Marker, FormatString);\r | |
2ad4dad0 LG |
485 | return AsciiVSPrintUnicodeFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r |
486 | }\r | |
487 | \r | |
488 | \r | |
489 | /**\r | |
490 | Converts a decimal value to a Null-terminated ASCII string.\r | |
491 | \r | |
492 | Converts the decimal number specified by Value to a Null-terminated ASCII string \r | |
493 | specified by Buffer containing at most Width characters. No padding of spaces \r | |
494 | is ever performed.\r | |
495 | If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r | |
496 | The number of ASCII characters in Buffer is returned not including the Null-terminator.\r | |
497 | If the conversion contains more than Width characters, then only the first Width\r | |
498 | characters are returned, and the total number of characters required to perform\r | |
499 | the conversion is returned.\r | |
500 | Additional conversion parameters are specified in Flags. \r | |
501 | The Flags bit LEFT_JUSTIFY is always ignored.\r | |
502 | All conversions are left justified in Buffer.\r | |
503 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
504 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r | |
505 | are inserted every 3rd digit starting from the right.\r | |
506 | If HEX_RADIX is set in Flags, then the output buffer will be \r | |
507 | formatted in hexadecimal format.\r | |
508 | If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.\r | |
509 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r | |
510 | then Buffer is padded with '0' characters so the combination of the optional '-' \r | |
511 | sign character, '0' characters, digit characters for Value, and the Null-terminator\r | |
512 | add up to Width characters.\r | |
513 | \r | |
514 | If Buffer is NULL, then ASSERT().\r | |
515 | If unsupported bits are set in Flags, then ASSERT().\r | |
516 | If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r | |
517 | If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r | |
518 | \r | |
519 | @param Buffer Pointer to the output buffer for the produced Null-terminated\r | |
520 | ASCII string.\r | |
521 | @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r | |
522 | @param Value The 64-bit signed value to convert to a string.\r | |
523 | @param Width The maximum number of ASCII characters to place in Buffer, not including\r | |
524 | the Null-terminator.\r | |
525 | \r | |
526 | @return The number of ASCII characters in Buffer not including the Null-terminator.\r | |
527 | \r | |
528 | **/\r | |
529 | UINTN\r | |
530 | EFIAPI\r | |
531 | AsciiValueToString (\r | |
ea99d5d1 | 532 | OUT CHAR8 *Buffer,\r |
533 | IN UINTN Flags,\r | |
534 | IN INT64 Value,\r | |
535 | IN UINTN Width\r | |
2ad4dad0 LG |
536 | )\r |
537 | {\r | |
bee67555 | 538 | return mPrint2Protocol->AsciiValueToString (Buffer, Flags, Value, Width);\r |
a0afd019 | 539 | }\r |