]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Base Print Library instance implementation.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r | |
5 | Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php.\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #include "PrintLibInternal.h"\r | |
17 | \r | |
18 | //\r | |
19 | // Declare a VA_LIST global variable that is used in calls to BasePrintLibSPrintMarker()\r | |
20 | // when the BASE_LIST parameter is valid and the VA_LIST parameter is ignored. \r | |
21 | // A NULL VA_LIST can not be passed into BasePrintLibSPrintMarker() because some \r | |
22 | // compilers define VA_LIST to be a structure.\r | |
23 | //\r | |
24 | VA_LIST gNullVaList;\r | |
25 | \r | |
26 | #define ASSERT_UNICODE_BUFFER(Buffer) ASSERT ((((UINTN) (Buffer)) & 0x01) == 0)\r | |
27 | \r | |
28 | /**\r | |
29 | Produces a Null-terminated Unicode string in an output buffer based on \r | |
30 | a Null-terminated Unicode format string and a VA_LIST argument list\r | |
31 | \r | |
32 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
33 | and BufferSize. \r | |
34 | The Unicode string is produced by parsing the format string specified by FormatString. \r | |
35 | Arguments are pulled from the variable argument list specified by Marker based on the \r | |
36 | contents of the format string. \r | |
37 | The number of Unicode characters in the produced output buffer is returned not including\r | |
38 | the Null-terminator.\r | |
39 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r | |
40 | \r | |
41 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r | |
42 | If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
43 | If BufferSize > 1 and FormatString is NULL, then ASSERT().\r | |
44 | If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
45 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r | |
46 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
47 | ASSERT().\r | |
48 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
49 | contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
50 | Null-terminator, then ASSERT().\r | |
51 | \r | |
52 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
53 | Unicode string.\r | |
54 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
55 | @param FormatString A Null-terminated Unicode format string.\r | |
56 | @param Marker VA_LIST marker for the variable argument list.\r | |
57 | \r | |
58 | @return The number of Unicode characters in the produced output buffer not including the\r | |
59 | Null-terminator.\r | |
60 | \r | |
61 | **/\r | |
62 | UINTN\r | |
63 | EFIAPI\r | |
64 | UnicodeVSPrint (\r | |
65 | OUT CHAR16 *StartOfBuffer,\r | |
66 | IN UINTN BufferSize,\r | |
67 | IN CONST CHAR16 *FormatString,\r | |
68 | IN VA_LIST Marker\r | |
69 | )\r | |
70 | {\r | |
71 | ASSERT_UNICODE_BUFFER (StartOfBuffer);\r | |
72 | ASSERT_UNICODE_BUFFER (FormatString);\r | |
73 | return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, Marker, NULL);\r | |
74 | }\r | |
75 | \r | |
76 | /**\r | |
77 | Produces a Null-terminated Unicode string in an output buffer based on \r | |
78 | a Null-terminated Unicode format string and a BASE_LIST argument list\r | |
79 | \r | |
80 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
81 | and BufferSize. \r | |
82 | The Unicode string is produced by parsing the format string specified by FormatString. \r | |
83 | Arguments are pulled from the variable argument list specified by Marker based on the \r | |
84 | contents of the format string. \r | |
85 | The number of Unicode characters in the produced output buffer is returned not including\r | |
86 | the Null-terminator.\r | |
87 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r | |
88 | \r | |
89 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r | |
90 | If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
91 | If BufferSize > 1 and FormatString is NULL, then ASSERT().\r | |
92 | If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
93 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r | |
94 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
95 | ASSERT().\r | |
96 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
97 | contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
98 | Null-terminator, then ASSERT().\r | |
99 | \r | |
100 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
101 | Unicode string.\r | |
102 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
103 | @param FormatString A Null-terminated Unicode format string.\r | |
104 | @param Marker BASE_LIST marker for the variable argument list.\r | |
105 | \r | |
106 | @return The number of Unicode characters in the produced output buffer not including the\r | |
107 | Null-terminator.\r | |
108 | \r | |
109 | **/\r | |
110 | UINTN\r | |
111 | EFIAPI\r | |
112 | UnicodeBSPrint (\r | |
113 | OUT CHAR16 *StartOfBuffer,\r | |
114 | IN UINTN BufferSize,\r | |
115 | IN CONST CHAR16 *FormatString,\r | |
116 | IN BASE_LIST Marker\r | |
117 | )\r | |
118 | {\r | |
119 | ASSERT_UNICODE_BUFFER (StartOfBuffer);\r | |
120 | ASSERT_UNICODE_BUFFER (FormatString);\r | |
121 | return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, gNullVaList, Marker);\r | |
122 | }\r | |
123 | \r | |
124 | /**\r | |
125 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r | |
126 | Unicode format string and variable argument list.\r | |
127 | \r | |
128 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
129 | and BufferSize.\r | |
130 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
131 | Arguments are pulled from the variable argument list based on the contents of the format string.\r | |
132 | The number of Unicode characters in the produced output buffer is returned not including\r | |
133 | the Null-terminator.\r | |
134 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r | |
135 | \r | |
136 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r | |
137 | If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
138 | If BufferSize > 1 and FormatString is NULL, then ASSERT().\r | |
139 | If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
140 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r | |
141 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
142 | ASSERT().\r | |
143 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
144 | contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
145 | Null-terminator, then ASSERT().\r | |
146 | \r | |
147 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
148 | Unicode string.\r | |
149 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
150 | @param FormatString A Null-terminated Unicode format string.\r | |
151 | @param ... Variable argument list whose contents are accessed based on the \r | |
152 | format string specified by FormatString.\r | |
153 | \r | |
154 | @return The number of Unicode characters in the produced output buffer not including the\r | |
155 | Null-terminator.\r | |
156 | \r | |
157 | **/\r | |
158 | UINTN\r | |
159 | EFIAPI\r | |
160 | UnicodeSPrint (\r | |
161 | OUT CHAR16 *StartOfBuffer,\r | |
162 | IN UINTN BufferSize,\r | |
163 | IN CONST CHAR16 *FormatString,\r | |
164 | ...\r | |
165 | )\r | |
166 | {\r | |
167 | VA_LIST Marker;\r | |
168 | \r | |
169 | VA_START (Marker, FormatString);\r | |
170 | return UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r | |
171 | }\r | |
172 | \r | |
173 | /**\r | |
174 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r | |
175 | ASCII format string and a VA_LIST argument list\r | |
176 | \r | |
177 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
178 | and BufferSize.\r | |
179 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
180 | Arguments are pulled from the variable argument list specified by Marker based on the \r | |
181 | contents of the format string.\r | |
182 | The number of Unicode characters in the produced output buffer is returned not including\r | |
183 | the Null-terminator.\r | |
184 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r | |
185 | \r | |
186 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r | |
187 | If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
188 | If BufferSize > 1 and FormatString is NULL, then ASSERT().\r | |
189 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r | |
190 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r | |
191 | ASSERT().\r | |
192 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
193 | contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
194 | Null-terminator, then ASSERT().\r | |
195 | \r | |
196 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
197 | Unicode string.\r | |
198 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
199 | @param FormatString A Null-terminated ASCII format string.\r | |
200 | @param Marker VA_LIST marker for the variable argument list.\r | |
201 | \r | |
202 | @return The number of Unicode characters in the produced output buffer not including the\r | |
203 | Null-terminator.\r | |
204 | \r | |
205 | **/\r | |
206 | UINTN\r | |
207 | EFIAPI\r | |
208 | UnicodeVSPrintAsciiFormat (\r | |
209 | OUT CHAR16 *StartOfBuffer,\r | |
210 | IN UINTN BufferSize,\r | |
211 | IN CONST CHAR8 *FormatString,\r | |
212 | IN VA_LIST Marker\r | |
213 | )\r | |
214 | {\r | |
215 | ASSERT_UNICODE_BUFFER (StartOfBuffer);\r | |
216 | return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE, FormatString, Marker, NULL);\r | |
217 | }\r | |
218 | \r | |
219 | /**\r | |
220 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r | |
221 | ASCII format string and a BASE_LIST argument list\r | |
222 | \r | |
223 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
224 | and BufferSize.\r | |
225 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
226 | Arguments are pulled from the variable argument list specified by Marker based on the \r | |
227 | contents of the format string.\r | |
228 | The number of Unicode characters in the produced output buffer is returned not including\r | |
229 | the Null-terminator.\r | |
230 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r | |
231 | \r | |
232 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r | |
233 | If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
234 | If BufferSize > 1 and FormatString is NULL, then ASSERT().\r | |
235 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r | |
236 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r | |
237 | ASSERT().\r | |
238 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
239 | contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
240 | Null-terminator, then ASSERT().\r | |
241 | \r | |
242 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
243 | Unicode string.\r | |
244 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
245 | @param FormatString A Null-terminated ASCII format string.\r | |
246 | @param Marker BASE_LIST marker for the variable argument list.\r | |
247 | \r | |
248 | @return The number of Unicode characters in the produced output buffer not including the\r | |
249 | Null-terminator.\r | |
250 | \r | |
251 | **/\r | |
252 | UINTN\r | |
253 | EFIAPI\r | |
254 | UnicodeBSPrintAsciiFormat (\r | |
255 | OUT CHAR16 *StartOfBuffer,\r | |
256 | IN UINTN BufferSize,\r | |
257 | IN CONST CHAR8 *FormatString,\r | |
258 | IN BASE_LIST Marker\r | |
259 | )\r | |
260 | {\r | |
261 | ASSERT_UNICODE_BUFFER (StartOfBuffer);\r | |
262 | return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE, FormatString, gNullVaList, Marker);\r | |
263 | }\r | |
264 | \r | |
265 | /**\r | |
266 | Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r | |
267 | ASCII format string and variable argument list.\r | |
268 | \r | |
269 | Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r | |
270 | and BufferSize.\r | |
271 | The Unicode string is produced by parsing the format string specified by FormatString.\r | |
272 | Arguments are pulled from the variable argument list based on the contents of the \r | |
273 | format string.\r | |
274 | The number of Unicode characters in the produced output buffer is returned not including\r | |
275 | the Null-terminator.\r | |
276 | If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r | |
277 | \r | |
278 | If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r | |
279 | If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
280 | If BufferSize > 1 and FormatString is NULL, then ASSERT().\r | |
281 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r | |
282 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r | |
283 | ASSERT().\r | |
284 | If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r | |
285 | contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r | |
286 | Null-terminator, then ASSERT().\r | |
287 | \r | |
288 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
289 | Unicode string.\r | |
290 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
291 | @param FormatString A Null-terminated ASCII format string.\r | |
292 | @param ... Variable argument list whose contents are accessed based on the \r | |
293 | format string specified by FormatString.\r | |
294 | \r | |
295 | @return The number of Unicode characters in the produced output buffer not including the\r | |
296 | Null-terminator.\r | |
297 | \r | |
298 | **/\r | |
299 | UINTN\r | |
300 | EFIAPI\r | |
301 | UnicodeSPrintAsciiFormat (\r | |
302 | OUT CHAR16 *StartOfBuffer,\r | |
303 | IN UINTN BufferSize,\r | |
304 | IN CONST CHAR8 *FormatString,\r | |
305 | ...\r | |
306 | )\r | |
307 | {\r | |
308 | VA_LIST Marker;\r | |
309 | \r | |
310 | VA_START (Marker, FormatString);\r | |
311 | return UnicodeVSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);\r | |
312 | }\r | |
313 | \r | |
314 | /**\r | |
315 | Converts a decimal value to a Null-terminated Unicode string.\r | |
316 | \r | |
317 | Converts the decimal number specified by Value to a Null-terminated Unicode \r | |
318 | string specified by Buffer containing at most Width characters. No padding of spaces \r | |
319 | is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r | |
320 | The number of Unicode characters in Buffer is returned not including the Null-terminator.\r | |
321 | If the conversion contains more than Width characters, then only the first\r | |
322 | Width characters are returned, and the total number of characters \r | |
323 | required to perform the conversion is returned.\r | |
324 | Additional conversion parameters are specified in Flags. \r | |
325 | \r | |
326 | The Flags bit LEFT_JUSTIFY is always ignored.\r | |
327 | All conversions are left justified in Buffer.\r | |
328 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
329 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r | |
330 | are inserted every 3rd digit starting from the right.\r | |
331 | If RADIX_HEX is set in Flags, then the output buffer will be \r | |
332 | formatted in hexadecimal format.\r | |
333 | If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.\r | |
334 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r | |
335 | then Buffer is padded with '0' characters so the combination of the optional '-' \r | |
336 | sign character, '0' characters, digit characters for Value, and the Null-terminator\r | |
337 | add up to Width characters.\r | |
338 | If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r | |
339 | If Buffer is NULL, then ASSERT().\r | |
340 | If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r | |
341 | If unsupported bits are set in Flags, then ASSERT().\r | |
342 | If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r | |
343 | If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r | |
344 | \r | |
345 | @param Buffer The pointer to the output buffer for the produced Null-terminated\r | |
346 | Unicode string.\r | |
347 | @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r | |
348 | @param Value The 64-bit signed value to convert to a string.\r | |
349 | @param Width The maximum number of Unicode characters to place in Buffer, not including\r | |
350 | the Null-terminator.\r | |
351 | \r | |
352 | @return The number of Unicode characters in Buffer not including the Null-terminator.\r | |
353 | \r | |
354 | **/\r | |
355 | UINTN\r | |
356 | EFIAPI\r | |
357 | UnicodeValueToString (\r | |
358 | IN OUT CHAR16 *Buffer,\r | |
359 | IN UINTN Flags,\r | |
360 | IN INT64 Value,\r | |
361 | IN UINTN Width\r | |
362 | )\r | |
363 | {\r | |
364 | ASSERT_UNICODE_BUFFER(Buffer);\r | |
365 | return BasePrintLibConvertValueToString ((CHAR8 *)Buffer, Flags, Value, Width, 2);\r | |
366 | }\r | |
367 | \r | |
368 | /**\r | |
369 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
370 | ASCII format string and a VA_LIST argument list.\r | |
371 | \r | |
372 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
373 | and BufferSize.\r | |
374 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
375 | Arguments are pulled from the variable argument list specified by Marker based on \r | |
376 | the contents of the format string.\r | |
377 | The number of ASCII characters in the produced output buffer is returned not including\r | |
378 | the Null-terminator.\r | |
379 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
380 | \r | |
381 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r | |
382 | If BufferSize > 0 and FormatString is NULL, then ASSERT().\r | |
383 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r | |
384 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r | |
385 | ASSERT().\r | |
386 | If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r | |
387 | contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
388 | Null-terminator, then ASSERT().\r | |
389 | \r | |
390 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
391 | ASCII string.\r | |
392 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
393 | @param FormatString A Null-terminated ASCII format string.\r | |
394 | @param Marker VA_LIST marker for the variable argument list.\r | |
395 | \r | |
396 | @return The number of ASCII characters in the produced output buffer not including the\r | |
397 | Null-terminator.\r | |
398 | \r | |
399 | **/\r | |
400 | UINTN\r | |
401 | EFIAPI\r | |
402 | AsciiVSPrint (\r | |
403 | OUT CHAR8 *StartOfBuffer,\r | |
404 | IN UINTN BufferSize,\r | |
405 | IN CONST CHAR8 *FormatString,\r | |
406 | IN VA_LIST Marker\r | |
407 | )\r | |
408 | {\r | |
409 | return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, Marker, NULL);\r | |
410 | }\r | |
411 | \r | |
412 | /**\r | |
413 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
414 | ASCII format string and a BASE_LIST argument list.\r | |
415 | \r | |
416 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
417 | and BufferSize.\r | |
418 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
419 | Arguments are pulled from the variable argument list specified by Marker based on \r | |
420 | the contents of the format string.\r | |
421 | The number of ASCII characters in the produced output buffer is returned not including\r | |
422 | the Null-terminator.\r | |
423 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
424 | \r | |
425 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r | |
426 | If BufferSize > 0 and FormatString is NULL, then ASSERT().\r | |
427 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r | |
428 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r | |
429 | ASSERT().\r | |
430 | If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r | |
431 | contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
432 | Null-terminator, then ASSERT().\r | |
433 | \r | |
434 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
435 | ASCII string.\r | |
436 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
437 | @param FormatString A Null-terminated ASCII format string.\r | |
438 | @param Marker BASE_LIST marker for the variable argument list.\r | |
439 | \r | |
440 | @return The number of ASCII characters in the produced output buffer not including the\r | |
441 | Null-terminator.\r | |
442 | \r | |
443 | **/\r | |
444 | UINTN\r | |
445 | EFIAPI\r | |
446 | AsciiBSPrint (\r | |
447 | OUT CHAR8 *StartOfBuffer,\r | |
448 | IN UINTN BufferSize,\r | |
449 | IN CONST CHAR8 *FormatString,\r | |
450 | IN BASE_LIST Marker\r | |
451 | )\r | |
452 | {\r | |
453 | return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, gNullVaList, Marker);\r | |
454 | }\r | |
455 | \r | |
456 | /**\r | |
457 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
458 | ASCII format string and variable argument list.\r | |
459 | \r | |
460 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
461 | and BufferSize.\r | |
462 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
463 | Arguments are pulled from the variable argument list based on the contents of the \r | |
464 | format string.\r | |
465 | The number of ASCII characters in the produced output buffer is returned not including\r | |
466 | the Null-terminator.\r | |
467 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
468 | \r | |
469 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r | |
470 | If BufferSize > 0 and FormatString is NULL, then ASSERT().\r | |
471 | If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r | |
472 | PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r | |
473 | ASSERT().\r | |
474 | If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r | |
475 | contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
476 | Null-terminator, then ASSERT().\r | |
477 | \r | |
478 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
479 | ASCII string.\r | |
480 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
481 | @param FormatString A Null-terminated ASCII format string.\r | |
482 | @param ... Variable argument list whose contents are accessed based on the \r | |
483 | format string specified by FormatString.\r | |
484 | \r | |
485 | @return The number of ASCII characters in the produced output buffer not including the\r | |
486 | Null-terminator.\r | |
487 | \r | |
488 | **/\r | |
489 | UINTN\r | |
490 | EFIAPI\r | |
491 | AsciiSPrint (\r | |
492 | OUT CHAR8 *StartOfBuffer,\r | |
493 | IN UINTN BufferSize,\r | |
494 | IN CONST CHAR8 *FormatString,\r | |
495 | ...\r | |
496 | )\r | |
497 | {\r | |
498 | VA_LIST Marker;\r | |
499 | \r | |
500 | VA_START (Marker, FormatString);\r | |
501 | return AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r | |
502 | }\r | |
503 | \r | |
504 | /**\r | |
505 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
506 | Unicode format string and a VA_LIST argument list.\r | |
507 | \r | |
508 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
509 | and BufferSize.\r | |
510 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
511 | Arguments are pulled from the variable argument list specified by Marker based on \r | |
512 | the contents of the format string.\r | |
513 | The number of ASCII characters in the produced output buffer is returned not including\r | |
514 | the Null-terminator.\r | |
515 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
516 | \r | |
517 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r | |
518 | If BufferSize > 0 and FormatString is NULL, then ASSERT().\r | |
519 | If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
520 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r | |
521 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
522 | ASSERT().\r | |
523 | If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r | |
524 | contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
525 | Null-terminator, then ASSERT().\r | |
526 | \r | |
527 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
528 | ASCII string.\r | |
529 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
530 | @param FormatString A Null-terminated Unicode format string.\r | |
531 | @param Marker VA_LIST marker for the variable argument list.\r | |
532 | \r | |
533 | @return The number of ASCII characters in the produced output buffer not including the\r | |
534 | Null-terminator.\r | |
535 | \r | |
536 | **/\r | |
537 | UINTN\r | |
538 | EFIAPI\r | |
539 | AsciiVSPrintUnicodeFormat (\r | |
540 | OUT CHAR8 *StartOfBuffer,\r | |
541 | IN UINTN BufferSize,\r | |
542 | IN CONST CHAR16 *FormatString,\r | |
543 | IN VA_LIST Marker\r | |
544 | )\r | |
545 | {\r | |
546 | ASSERT_UNICODE_BUFFER (FormatString);\r | |
547 | return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, Marker, NULL);\r | |
548 | }\r | |
549 | \r | |
550 | /**\r | |
551 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
552 | Unicode format string and a BASE_LIST argument list.\r | |
553 | \r | |
554 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
555 | and BufferSize.\r | |
556 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
557 | Arguments are pulled from the variable argument list specified by Marker based on \r | |
558 | the contents of the format string.\r | |
559 | The number of ASCII characters in the produced output buffer is returned not including\r | |
560 | the Null-terminator.\r | |
561 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
562 | \r | |
563 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r | |
564 | If BufferSize > 0 and FormatString is NULL, then ASSERT().\r | |
565 | If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
566 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r | |
567 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
568 | ASSERT().\r | |
569 | If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r | |
570 | contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
571 | Null-terminator, then ASSERT().\r | |
572 | \r | |
573 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
574 | ASCII string.\r | |
575 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
576 | @param FormatString A Null-terminated Unicode format string.\r | |
577 | @param Marker BASE_LIST marker for the variable argument list.\r | |
578 | \r | |
579 | @return The number of ASCII characters in the produced output buffer not including the\r | |
580 | Null-terminator.\r | |
581 | \r | |
582 | **/\r | |
583 | UINTN\r | |
584 | EFIAPI\r | |
585 | AsciiBSPrintUnicodeFormat (\r | |
586 | OUT CHAR8 *StartOfBuffer,\r | |
587 | IN UINTN BufferSize,\r | |
588 | IN CONST CHAR16 *FormatString,\r | |
589 | IN BASE_LIST Marker\r | |
590 | )\r | |
591 | {\r | |
592 | ASSERT_UNICODE_BUFFER (FormatString);\r | |
593 | return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, gNullVaList, Marker);\r | |
594 | }\r | |
595 | \r | |
596 | /**\r | |
597 | Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r | |
598 | Unicode format string and variable argument list.\r | |
599 | \r | |
600 | Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r | |
601 | and BufferSize.\r | |
602 | The ASCII string is produced by parsing the format string specified by FormatString.\r | |
603 | Arguments are pulled from the variable argument list based on the contents of the \r | |
604 | format string.\r | |
605 | The number of ASCII characters in the produced output buffer is returned not including\r | |
606 | the Null-terminator.\r | |
607 | If BufferSize is 0, then no output buffer is produced and 0 is returned.\r | |
608 | \r | |
609 | If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r | |
610 | If BufferSize > 0 and FormatString is NULL, then ASSERT().\r | |
611 | If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
612 | If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r | |
613 | PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r | |
614 | ASSERT().\r | |
615 | If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r | |
616 | contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r | |
617 | Null-terminator, then ASSERT().\r | |
618 | \r | |
619 | @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r | |
620 | ASCII string.\r | |
621 | @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r | |
622 | @param FormatString A Null-terminated Unicode format string.\r | |
623 | @param ... Variable argument list whose contents are accessed based on the \r | |
624 | format string specified by FormatString.\r | |
625 | \r | |
626 | @return The number of ASCII characters in the produced output buffer not including the\r | |
627 | Null-terminator.\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 | \r | |
646 | /**\r | |
647 | Converts a decimal value to a Null-terminated ASCII string.\r | |
648 | \r | |
649 | Converts the decimal number specified by Value to a Null-terminated ASCII string \r | |
650 | specified by Buffer containing at most Width characters. No padding of spaces \r | |
651 | is ever performed.\r | |
652 | If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r | |
653 | The number of ASCII characters in Buffer is returned not including the Null-terminator.\r | |
654 | If the conversion contains more than Width characters, then only the first Width\r | |
655 | characters are returned, and the total number of characters required to perform\r | |
656 | the conversion is returned.\r | |
657 | Additional conversion parameters are specified in Flags. \r | |
658 | The Flags bit LEFT_JUSTIFY is always ignored.\r | |
659 | All conversions are left justified in Buffer.\r | |
660 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
661 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r | |
662 | are inserted every 3rd digit starting from the right.\r | |
663 | If RADIX_HEX is set in Flags, then the output buffer will be \r | |
664 | formatted in hexadecimal format.\r | |
665 | If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.\r | |
666 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r | |
667 | then Buffer is padded with '0' characters so the combination of the optional '-' \r | |
668 | sign character, '0' characters, digit characters for Value, and the Null-terminator\r | |
669 | add up to Width characters.\r | |
670 | \r | |
671 | If Buffer is NULL, then ASSERT().\r | |
672 | If unsupported bits are set in Flags, then ASSERT().\r | |
673 | If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r | |
674 | If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r | |
675 | \r | |
676 | @param Buffer The pointer to the output buffer for the produced Null-terminated\r | |
677 | ASCII string.\r | |
678 | @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r | |
679 | @param Value The 64-bit signed value to convert to a string.\r | |
680 | @param Width The maximum number of ASCII characters to place in Buffer, not including\r | |
681 | the Null-terminator.\r | |
682 | \r | |
683 | @return The number of ASCII characters in Buffer not including the Null-terminator.\r | |
684 | \r | |
685 | **/\r | |
686 | UINTN\r | |
687 | EFIAPI\r | |
688 | AsciiValueToString (\r | |
689 | OUT CHAR8 *Buffer,\r | |
690 | IN UINTN Flags,\r | |
691 | IN INT64 Value,\r | |
692 | IN UINTN Width\r | |
693 | )\r | |
694 | {\r | |
695 | return BasePrintLibConvertValueToString (Buffer, Flags, Value, Width, 1);\r | |
696 | }\r | |
697 | \r | |
698 | /**\r | |
699 | Returns the number of characters that would be produced by if the formatted \r | |
700 | output were produced not including the Null-terminator.\r | |
701 | \r | |
702 | If FormatString is NULL, then ASSERT().\r | |
703 | If FormatString is not aligned on a 16-bit boundary, then ASSERT().\r | |
704 | \r | |
705 | @param[in] FormatString A Null-terminated Unicode format string.\r | |
706 | @param[in] Marker VA_LIST marker for the variable argument list.\r | |
707 | \r | |
708 | @return The number of characters that would be produced, not including the \r | |
709 | Null-terminator.\r | |
710 | **/\r | |
711 | UINTN\r | |
712 | EFIAPI\r | |
713 | SPrintLength (\r | |
714 | IN CONST CHAR16 *FormatString,\r | |
715 | IN VA_LIST Marker\r | |
716 | )\r | |
717 | {\r | |
718 | ASSERT(FormatString != NULL);\r | |
719 | ASSERT_UNICODE_BUFFER (FormatString);\r | |
720 | return BasePrintLibSPrintMarker (NULL, 0, FORMAT_UNICODE | OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL);\r | |
721 | }\r | |
722 | \r | |
723 | /**\r | |
724 | Returns the number of characters that would be produced by if the formatted \r | |
725 | output were produced not including the Null-terminator.\r | |
726 | \r | |
727 | If FormatString is NULL, then ASSERT().\r | |
728 | \r | |
729 | @param[in] FormatString A Null-terminated ASCII format string.\r | |
730 | @param[in] Marker VA_LIST marker for the variable argument list.\r | |
731 | \r | |
732 | @return The number of characters that would be produced, not including the \r | |
733 | Null-terminator.\r | |
734 | **/\r | |
735 | UINTN\r | |
736 | EFIAPI\r | |
737 | SPrintLengthAsciiFormat (\r | |
738 | IN CONST CHAR8 *FormatString,\r | |
739 | IN VA_LIST Marker\r | |
740 | )\r | |
741 | {\r | |
742 | ASSERT(FormatString != NULL);\r | |
743 | return BasePrintLibSPrintMarker (NULL, 0, OUTPUT_UNICODE | COUNT_ONLY_NO_PRINT, (CHAR8 *)FormatString, Marker, NULL);\r | |
744 | }\r |