]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/PrintLib.h
2 Library that provides print services
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 Module Name: PrintLib.h
17 #ifndef __PRINT_LIB_H__
18 #define __PRINT_LIB_H__
21 /// Define the maximum number of characters that are required to
22 /// encode a decimal, hexidecimal, GUID, or TIME value with a NULL
25 /// Maximum Length Decimal String = 28
26 /// "-9,223,372,036,854,775,808"
27 /// Maximum Length Hexidecimal String = 17
28 /// "FFFFFFFFFFFFFFFF"
29 /// Maximum Length GUID = 37
30 /// "00000000-0000-0000-0000-000000000000"
31 /// Maximum Length TIME = 18
32 /// "12/12/2006 12:12"
34 #define MAXIMUM_VALUE_CHARACTERS 38
37 /// Flags bitmask values use in UnicodeValueToString() and
38 /// AcsiiValueToString()
40 #define LEFT_JUSTIFY 0x01
41 #define COMMA_TYPE 0x08
42 #define PREFIX_ZERO 0x20
45 Produces a Null-terminated Unicode string in an output buffer based on
46 a Null-terminated Unicode format string and a VA_LIST argument list
48 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
50 The Unicode string is produced by parsing the format string specified by FormatString.
51 Arguments are pulled from the variable argument list specified by Marker based on the
52 contents of the format string.
53 The number of Unicode characters in the produced output buffer is returned not including
55 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
57 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
58 If BufferSize > 1 and FormatString is NULL, then ASSERT().
59 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
60 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
62 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
63 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
64 Null-terminator, then ASSERT().
66 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
68 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
69 @param FormatString Null-terminated Unicode format string.
70 @param Marker VA_LIST marker for the variable argument list.
72 @return The number of Unicode characters in the produced output buffer not including the
79 OUT CHAR16
*StartOfBuffer
,
81 IN CONST CHAR16
*FormatString
,
86 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
87 Unicode format string and variable argument list.
89 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
91 The Unicode string is produced by parsing the format string specified by FormatString.
92 Arguments are pulled from the variable argument list based on the contents of the format string.
93 The number of Unicode characters in the produced output buffer is returned not including
95 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
97 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
98 If BufferSize > 1 and FormatString is NULL, then ASSERT().
99 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
100 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
102 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
103 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
104 Null-terminator, then ASSERT().
106 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
108 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
109 @param FormatString Null-terminated Unicode format string.
111 @return The number of Unicode characters in the produced output buffer not including the
118 OUT CHAR16
*StartOfBuffer
,
120 IN CONST CHAR16
*FormatString
,
125 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
126 ASCII format string and a VA_LIST argument list
128 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
130 The Unicode string is produced by parsing the format string specified by FormatString.
131 Arguments are pulled from the variable argument list specified by Marker based on the
132 contents of the format string.
133 The number of Unicode characters in the produced output buffer is returned not including
135 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
137 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
138 If BufferSize > 1 and FormatString is NULL, then ASSERT().
139 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
140 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
142 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
143 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
144 Null-terminator, then ASSERT().
146 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
148 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
149 @param FormatString Null-terminated Unicode format string.
150 @param Marker VA_LIST marker for the variable argument list.
152 @return The number of Unicode characters in the produced output buffer not including the
158 UnicodeVSPrintAsciiFormat (
159 OUT CHAR16
*StartOfBuffer
,
161 IN CONST CHAR8
*FormatString
,
166 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
167 ASCII format string and variable argument list.
169 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
171 The Unicode string is produced by parsing the format string specified by FormatString.
172 Arguments are pulled from the variable argument list based on the contents of the
174 The number of Unicode characters in the produced output buffer is returned not including
176 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
178 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
179 If BufferSize > 1 and FormatString is NULL, then ASSERT().
180 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
181 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
183 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
184 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
185 Null-terminator, then ASSERT().
187 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
189 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
190 @param FormatString Null-terminated Unicode format string.
192 @return The number of Unicode characters in the produced output buffer not including the
198 UnicodeSPrintAsciiFormat (
199 OUT CHAR16
*StartOfBuffer
,
201 IN CONST CHAR8
*FormatString
,
206 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
207 ASCII format string and a VA_LIST argument list.
209 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
211 The ASCII string is produced by parsing the format string specified by FormatString.
212 Arguments are pulled from the variable argument list specified by Marker based on
213 the contents of the format string.
214 The number of ASCII characters in the produced output buffer is returned not including
216 If BufferSize is 0, then no output buffer is produced and 0 is returned.
218 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
219 If BufferSize > 0 and FormatString is NULL, then ASSERT().
220 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
221 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
223 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
224 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
225 Null-terminator, then ASSERT().
227 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
229 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
230 @param FormatString Null-terminated Unicode format string.
231 @param Marker VA_LIST marker for the variable argument list.
233 @return The number of ASCII characters in the produced output buffer not including the
240 OUT CHAR8
*StartOfBuffer
,
242 IN CONST CHAR8
*FormatString
,
247 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
248 ASCII format string and variable argument list.
250 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
252 The ASCII string is produced by parsing the format string specified by FormatString.
253 Arguments are pulled from the variable argument list based on the contents of the
255 The number of ASCII characters in the produced output buffer is returned not including
257 If BufferSize is 0, then no output buffer is produced and 0 is returned.
259 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
260 If BufferSize > 0 and FormatString is NULL, then ASSERT().
261 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
262 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
264 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
265 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
266 Null-terminator, then ASSERT().
268 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
270 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
271 @param FormatString Null-terminated Unicode format string.
273 @return The number of ASCII characters in the produced output buffer not including the
280 OUT CHAR8
*StartOfBuffer
,
282 IN CONST CHAR8
*FormatString
,
287 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
288 ASCII format string and a VA_LIST argument list.
290 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
292 The ASCII string is produced by parsing the format string specified by FormatString.
293 Arguments are pulled from the variable argument list specified by Marker based on
294 the contents of the format string.
295 The number of ASCII characters in the produced output buffer is returned not including
297 If BufferSize is 0, then no output buffer is produced and 0 is returned.
299 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
300 If BufferSize > 0 and FormatString is NULL, then ASSERT().
301 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
302 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
304 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
305 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
306 Null-terminator, then ASSERT().
308 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
310 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
311 @param FormatString Null-terminated Unicode format string.
312 @param Marker VA_LIST marker for the variable argument list.
314 @return The number of ASCII characters in the produced output buffer not including the
320 AsciiVSPrintUnicodeFormat (
321 OUT CHAR8
*StartOfBuffer
,
323 IN CONST CHAR16
*FormatString
,
328 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
329 ASCII format string and variable argument list.
331 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
333 The ASCII string is produced by parsing the format string specified by FormatString.
334 Arguments are pulled from the variable argument list based on the contents of the
336 The number of ASCII characters in the produced output buffer is returned not including
338 If BufferSize is 0, then no output buffer is produced and 0 is returned.
340 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
341 If BufferSize > 0 and FormatString is NULL, then ASSERT().
342 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
343 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
345 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
346 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
347 Null-terminator, then ASSERT().
349 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
351 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
352 @param FormatString Null-terminated Unicode format string.
354 @return The number of ASCII characters in the produced output buffer not including the
360 AsciiSPrintUnicodeFormat (
361 OUT CHAR8
*StartOfBuffer
,
363 IN CONST CHAR16
*FormatString
,
368 Converts a decimal value to a Null-terminated Unicode string.
370 Converts the decimal number specified by Value to a Null-terminated Unicode
371 string specified by Buffer containing at most Width characters.
372 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
373 The number of Unicode characters in Buffer is returned not including the Null-terminator.
374 If the conversion contains more than Width characters, then only the first
375 Width characters are returned, and the total number of characters
376 required to perform the conversion is returned.
377 Additional conversion parameters are specified in Flags.
378 The Flags bit LEFT_JUSTIFY is always ignored.
379 All conversions are left justified in Buffer.
380 If Width is 0, PREFIX_ZERO is ignored in Flags.
381 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
382 are inserted every 3rd digit starting from the right.
383 If Value is < 0, then the fist character in Buffer is a '-'.
384 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
385 then Buffer is padded with '0' characters so the combination of the optional '-'
386 sign character, '0' characters, digit characters for Value, and the Null-terminator
387 add up to Width characters.
389 If Buffer is NULL, then ASSERT().
390 If unsupported bits are set in Flags, then ASSERT().
391 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
393 @param Buffer Pointer to the output buffer for the produced Null-terminated
395 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
396 @param Value The 64-bit signed value to convert to a string.
397 @param Width The maximum number of Unicode characters to place in Buffer, not including
400 @return The number of Unicode characters in Buffer not including the Null-terminator.
405 UnicodeValueToString (
406 IN OUT CHAR16
*Buffer
,
413 Converts a decimal value to a Null-terminated ASCII string.
415 Converts the decimal number specified by Value to a Null-terminated ASCII string
416 specified by Buffer containing at most Width characters.
417 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
418 The number of ASCII characters in Buffer is returned not including the Null-terminator.
419 If the conversion contains more than Width characters, then only the first Width
420 characters are returned, and the total number of characters required to perform
421 the conversion is returned.
422 Additional conversion parameters are specified in Flags.
423 The Flags bit LEFT_JUSTIFY is always ignored.
424 All conversions are left justified in Buffer.
425 If Width is 0, PREFIX_ZERO is ignored in Flags.
426 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
427 are inserted every 3rd digit starting from the right.
428 If Value is < 0, then the fist character in Buffer is a '-'.
429 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, then Buffer
430 is padded with '0' characters so the combination of the optional '-'
431 sign character, '0' characters, digit characters for Value, and the
432 Null-terminator add up to Width characters.
434 If Buffer is NULL, then ASSERT().
435 If unsupported bits are set in Flags, then ASSERT().
436 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
438 @param Buffer Pointer to the output buffer for the produced Null-terminated
440 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
441 @param Value The 64-bit signed value to convert to a string.
442 @param Width The maximum number of ASCII characters to place in Buffer, not including
445 @return The number of ASCII characters in Buffer not including the Null-terminator.
451 IN OUT CHAR8
*Buffer
,