]>
git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGluePrintLib.h
54a870e89f0012b685a307973711516e5750040c
3 Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 Public header file Print Lib
23 #ifndef __EDKII_GLUE_PRINT_LIB_H__
24 #define __EDKII_GLUE_PRINT_LIB_H__
27 /// Define the maximum number of characters that are required to
28 /// encode a decimal, hexadecimal, GUID, or TIME value with a NULL
31 /// Maximum Length Decimal String = 28
32 /// "-9,223,372,036,854,775,808"
33 /// Maximum Length Hexidecimal String = 17
34 /// "FFFFFFFFFFFFFFFF"
35 /// Maximum Length GUID = 37
36 /// "00000000-0000-0000-0000-000000000000"
37 /// Maximum Length TIME = 18
38 /// "12/12/2006 12:12"
40 #define MAXIMUM_VALUE_CHARACTERS 38
43 /// Flags bitmask values use in UnicodeValueToString() and
44 /// AsciiValueToString()
46 #define LEFT_JUSTIFY 0x01
47 #define COMMA_TYPE 0x08
48 #define PREFIX_ZERO 0x20
49 #define RADIX_HEX 0x80
52 Produces a Null-terminated Unicode string in an output buffer based on
53 a Null-terminated Unicode format string and a VA_LIST argument list
55 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
57 The Unicode string is produced by parsing the format string specified by FormatString.
58 Arguments are pulled from the variable argument list specified by Marker based on the
59 contents of the format string.
60 The number of Unicode characters in the produced output buffer is returned not including
62 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
64 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
65 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
66 If BufferSize > 1 and FormatString is NULL, then ASSERT().
67 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
68 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
69 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
71 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
72 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
73 Null-terminator, then ASSERT().
75 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
77 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
78 @param FormatString Null-terminated Unicode format string.
79 @param Marker VA_LIST marker for the variable argument list.
81 @return The number of Unicode characters in the produced output buffer not including the
88 OUT CHAR16
*StartOfBuffer
,
90 IN CONST CHAR16
*FormatString
,
95 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
96 Unicode format string and variable argument list.
98 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
100 The Unicode string is produced by parsing the format string specified by FormatString.
101 Arguments are pulled from the variable argument list based on the contents of the format string.
102 The number of Unicode characters in the produced output buffer is returned not including
104 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
106 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
107 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
108 If BufferSize > 1 and FormatString is NULL, then ASSERT().
109 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
110 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
111 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
113 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
114 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
115 Null-terminator, then ASSERT().
117 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
119 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
120 @param FormatString Null-terminated Unicode format string.
122 @return The number of Unicode characters in the produced output buffer not including the
129 OUT CHAR16
*StartOfBuffer
,
131 IN CONST CHAR16
*FormatString
,
136 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
137 ASCII format string and a VA_LIST argument list
139 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
141 The Unicode string is produced by parsing the format string specified by FormatString.
142 Arguments are pulled from the variable argument list specified by Marker based on the
143 contents of the format string.
144 The number of Unicode characters in the produced output buffer is returned not including
146 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
148 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
149 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
150 If BufferSize > 1 and FormatString is NULL, then ASSERT().
151 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
152 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
154 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
155 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
156 Null-terminator, then ASSERT().
158 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
160 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
161 @param FormatString Null-terminated Unicode format string.
162 @param Marker VA_LIST marker for the variable argument list.
164 @return The number of Unicode characters in the produced output buffer not including the
170 UnicodeVSPrintAsciiFormat (
171 OUT CHAR16
*StartOfBuffer
,
173 IN CONST CHAR8
*FormatString
,
178 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated
179 ASCII format string and variable argument list.
181 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer
183 The Unicode string is produced by parsing the format string specified by FormatString.
184 Arguments are pulled from the variable argument list based on the contents of the
186 The number of Unicode characters in the produced output buffer is returned not including
188 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.
190 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().
191 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().
192 If BufferSize > 1 and FormatString is NULL, then ASSERT().
193 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
194 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
196 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string
197 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the
198 Null-terminator, then ASSERT().
200 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
202 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
203 @param FormatString Null-terminated Unicode format string.
205 @return The number of Unicode characters in the produced output buffer not including the
211 UnicodeSPrintAsciiFormat (
212 OUT CHAR16
*StartOfBuffer
,
214 IN CONST CHAR8
*FormatString
,
219 Converts a decimal value to a Null-terminated Unicode string.
221 Converts the decimal number specified by Value to a Null-terminated Unicode
222 string specified by Buffer containing at most Width characters. No padding of spaces
223 is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
224 The number of Unicode characters in Buffer is returned not including the Null-terminator.
225 If the conversion contains more than Width characters, then only the first
226 Width characters are returned, and the total number of characters
227 required to perform the conversion is returned.
228 Additional conversion parameters are specified in Flags.
230 The Flags bit LEFT_JUSTIFY is always ignored.
231 All conversions are left justified in Buffer.
232 If Width is 0, PREFIX_ZERO is ignored in Flags.
233 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
234 are inserted every 3rd digit starting from the right.
235 If RADIX_HEX is set in Flags, then the output buffer will be
236 formatted in hexadecimal format.
237 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
238 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
239 then Buffer is padded with '0' characters so the combination of the optional '-'
240 sign character, '0' characters, digit characters for Value, and the Null-terminator
241 add up to Width characters.
242 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
243 If Buffer is NULL, then ASSERT().
244 If Buffer is not aligned on a 16-bit boundary, then ASSERT().
245 If unsupported bits are set in Flags, then ASSERT().
246 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
247 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
249 @param Buffer Pointer to the output buffer for the produced Null-terminated
251 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
252 @param Value The 64-bit signed value to convert to a string.
253 @param Width The maximum number of Unicode characters to place in Buffer, not including
256 @return The number of Unicode characters in Buffer not including the Null-terminator.
261 UnicodeValueToString (
262 IN OUT CHAR16
*Buffer
,
269 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
270 ASCII format string and a VA_LIST argument list.
272 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
274 The ASCII string is produced by parsing the format string specified by FormatString.
275 Arguments are pulled from the variable argument list specified by Marker based on
276 the contents of the format string.
277 The number of ASCII characters in the produced output buffer is returned not including
279 If BufferSize is 0, then no output buffer is produced and 0 is returned.
281 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
282 If BufferSize > 0 and FormatString is NULL, then ASSERT().
283 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
284 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
286 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
287 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
288 Null-terminator, then ASSERT().
290 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
292 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
293 @param FormatString Null-terminated Unicode format string.
294 @param Marker VA_LIST marker for the variable argument list.
296 @return The number of ASCII characters in the produced output buffer not including the
303 OUT CHAR8
*StartOfBuffer
,
305 IN CONST CHAR8
*FormatString
,
310 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
311 ASCII format string and variable argument list.
313 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
315 The ASCII string is produced by parsing the format string specified by FormatString.
316 Arguments are pulled from the variable argument list based on the contents of the
318 The number of ASCII characters in the produced output buffer is returned not including
320 If BufferSize is 0, then no output buffer is produced and 0 is returned.
322 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
323 If BufferSize > 0 and FormatString is NULL, then ASSERT().
324 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than
325 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then
327 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
328 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
329 Null-terminator, then ASSERT().
331 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
333 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
334 @param FormatString Null-terminated Unicode format string.
336 @return The number of ASCII characters in the produced output buffer not including the
343 OUT CHAR8
*StartOfBuffer
,
345 IN CONST CHAR8
*FormatString
,
350 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
351 ASCII format string and a VA_LIST argument list.
353 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
355 The ASCII string is produced by parsing the format string specified by FormatString.
356 Arguments are pulled from the variable argument list specified by Marker based on
357 the contents of the format string.
358 The number of ASCII characters in the produced output buffer is returned not including
360 If BufferSize is 0, then no output buffer is produced and 0 is returned.
362 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
363 If BufferSize > 0 and FormatString is NULL, then ASSERT().
364 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
365 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
366 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
368 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
369 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
370 Null-terminator, then ASSERT().
372 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
374 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
375 @param FormatString Null-terminated Unicode format string.
376 @param Marker VA_LIST marker for the variable argument list.
378 @return The number of ASCII characters in the produced output buffer not including the
384 AsciiVSPrintUnicodeFormat (
385 OUT CHAR8
*StartOfBuffer
,
387 IN CONST CHAR16
*FormatString
,
392 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated
393 ASCII format string and variable argument list.
395 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer
397 The ASCII string is produced by parsing the format string specified by FormatString.
398 Arguments are pulled from the variable argument list based on the contents of the
400 The number of ASCII characters in the produced output buffer is returned not including
402 If BufferSize is 0, then no output buffer is produced and 0 is returned.
404 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().
405 If BufferSize > 0 and FormatString is NULL, then ASSERT().
406 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().
407 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than
408 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then
410 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string
411 contains more than PcdMaximumAsciiStringLength ASCII characters not including the
412 Null-terminator, then ASSERT().
414 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated
416 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.
417 @param FormatString Null-terminated Unicode format string.
419 @return The number of ASCII characters in the produced output buffer not including the
425 AsciiSPrintUnicodeFormat (
426 OUT CHAR8
*StartOfBuffer
,
428 IN CONST CHAR16
*FormatString
,
433 Converts a decimal value to a Null-terminated ASCII string.
435 Converts the decimal number specified by Value to a Null-terminated ASCII string
436 specified by Buffer containing at most Width characters. No padding of spaces
438 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.
439 The number of ASCII characters in Buffer is returned not including the Null-terminator.
440 If the conversion contains more than Width characters, then only the first Width
441 characters are returned, and the total number of characters required to perform
442 the conversion is returned.
443 Additional conversion parameters are specified in Flags.
444 The Flags bit LEFT_JUSTIFY is always ignored.
445 All conversions are left justified in Buffer.
446 If Width is 0, PREFIX_ZERO is ignored in Flags.
447 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas
448 are inserted every 3rd digit starting from the right.
449 If RADIX_HEX is set in Flags, then the output buffer will be
450 formatted in hexadecimal format.
451 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.
452 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored,
453 then Buffer is padded with '0' characters so the combination of the optional '-'
454 sign character, '0' characters, digit characters for Value, and the Null-terminator
455 add up to Width characters.
457 If Buffer is NULL, then ASSERT().
458 If unsupported bits are set in Flags, then ASSERT().
459 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().
460 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()
462 @param Buffer Pointer to the output buffer for the produced Null-terminated
464 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.
465 @param Value The 64-bit signed value to convert to a string.
466 @param Width The maximum number of ASCII characters to place in Buffer, not including
469 @return The number of ASCII characters in Buffer not including the Null-terminator.
475 IN OUT CHAR8
*Buffer
,