]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGluePrintLib.h
EdkCompatibilityPkg: Fix typos in comments
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Include / Library / EdkIIGluePrintLib.h
CommitLineData
3eb9473e 1/*++\r
2\r
2c7e5c2f
HT
3Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>\r
4This program and the accompanying materials \r
3eb9473e 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12\r
13Module Name:\r
14\r
15 EdkIIGluePrintLib.h\r
16 \r
17Abstract: \r
18\r
19 Public header file Print Lib\r
20\r
21--*/\r
22\r
23#ifndef __EDKII_GLUE_PRINT_LIB_H__\r
24#define __EDKII_GLUE_PRINT_LIB_H__\r
25\r
26///\r
27/// Define the maximum number of characters that are required to\r
4fc0be87 28/// encode a decimal, hexadecimal, GUID, or TIME value with a NULL\r
3eb9473e 29/// terminator.\r
30/// \r
31/// Maximum Length Decimal String = 28\r
32/// "-9,223,372,036,854,775,808"\r
33/// Maximum Length Hexidecimal String = 17\r
34/// "FFFFFFFFFFFFFFFF"\r
35/// Maximum Length GUID = 37\r
36/// "00000000-0000-0000-0000-000000000000"\r
37/// Maximum Length TIME = 18\r
38/// "12/12/2006 12:12"\r
39///\r
40#define MAXIMUM_VALUE_CHARACTERS 38\r
41\r
42///\r
43/// Flags bitmask values use in UnicodeValueToString() and \r
44/// AsciiValueToString()\r
45///\r
46#define LEFT_JUSTIFY 0x01\r
47#define COMMA_TYPE 0x08\r
48#define PREFIX_ZERO 0x20\r
49#define RADIX_HEX 0x80\r
50\r
51/**\r
52 Produces a Null-terminated Unicode string in an output buffer based on \r
53 a Null-terminated Unicode format string and a VA_LIST argument list\r
54 \r
55 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
56 and BufferSize. \r
57 The Unicode string is produced by parsing the format string specified by FormatString. \r
58 Arguments are pulled from the variable argument list specified by Marker based on the \r
59 contents of the format string. \r
60 The number of Unicode characters in the produced output buffer is returned not including\r
61 the Null-terminator.\r
62 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
63\r
64 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
65 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
66 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
67 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
68 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r
69 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
70 ASSERT().\r
71 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
72 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
73 Null-terminator, then ASSERT().\r
74\r
75 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
76 Unicode string.\r
77 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
78 @param FormatString Null-terminated Unicode format string.\r
79 @param Marker VA_LIST marker for the variable argument list.\r
80 \r
81 @return The number of Unicode characters in the produced output buffer not including the\r
82 Null-terminator.\r
83\r
84**/\r
85UINTN\r
86EFIAPI\r
87UnicodeVSPrint (\r
88 OUT CHAR16 *StartOfBuffer,\r
89 IN UINTN BufferSize,\r
90 IN CONST CHAR16 *FormatString,\r
91 IN VA_LIST Marker\r
92 );\r
93\r
94/**\r
95 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r
96 Unicode format string and variable argument list.\r
97 \r
98 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
99 and BufferSize.\r
100 The Unicode string is produced by parsing the format string specified by FormatString.\r
101 Arguments are pulled from the variable argument list based on the contents of the format string.\r
102 The number of Unicode characters in the produced output buffer is returned not including\r
103 the Null-terminator.\r
104 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
105\r
106 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
107 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
108 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
109 If BufferSize > 1 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
110 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than \r
111 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
112 ASSERT().\r
113 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
114 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
115 Null-terminator, then ASSERT().\r
116\r
117 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
118 Unicode string.\r
119 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
120 @param FormatString Null-terminated Unicode format string.\r
121 \r
122 @return The number of Unicode characters in the produced output buffer not including the\r
123 Null-terminator.\r
124\r
125**/\r
126UINTN\r
127EFIAPI\r
128UnicodeSPrint (\r
129 OUT CHAR16 *StartOfBuffer,\r
130 IN UINTN BufferSize,\r
131 IN CONST CHAR16 *FormatString,\r
132 ...\r
133 );\r
134\r
135/**\r
136 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r
137 ASCII format string and a VA_LIST argument list\r
138 \r
139 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
140 and BufferSize.\r
141 The Unicode string is produced by parsing the format string specified by FormatString.\r
142 Arguments are pulled from the variable argument list specified by Marker based on the \r
143 contents of the format string.\r
144 The number of Unicode characters in the produced output buffer is returned not including\r
145 the Null-terminator.\r
146 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
147\r
148 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
149 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
150 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
151 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
152 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
153 ASSERT().\r
154 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
155 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
156 Null-terminator, then ASSERT().\r
157\r
158 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
159 Unicode string.\r
160 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
161 @param FormatString Null-terminated Unicode format string.\r
162 @param Marker VA_LIST marker for the variable argument list.\r
163 \r
164 @return The number of Unicode characters in the produced output buffer not including the\r
165 Null-terminator.\r
166\r
167**/\r
168UINTN\r
169EFIAPI\r
170UnicodeVSPrintAsciiFormat (\r
171 OUT CHAR16 *StartOfBuffer,\r
172 IN UINTN BufferSize,\r
173 IN CONST CHAR8 *FormatString,\r
174 IN VA_LIST Marker\r
175 );\r
176\r
177/**\r
178 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated \r
179 ASCII format string and variable argument list.\r
180 \r
181 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
182 and BufferSize.\r
183 The Unicode string is produced by parsing the format string specified by FormatString.\r
184 Arguments are pulled from the variable argument list based on the contents of the \r
185 format string.\r
186 The number of Unicode characters in the produced output buffer is returned not including\r
187 the Null-terminator.\r
188 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
189\r
190 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
191 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
192 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
193 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
194 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
195 ASSERT().\r
196 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
197 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
198 Null-terminator, then ASSERT().\r
199\r
200 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
201 Unicode string.\r
202 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
203 @param FormatString Null-terminated Unicode format string.\r
204 \r
205 @return The number of Unicode characters in the produced output buffer not including the\r
206 Null-terminator.\r
207\r
208**/\r
209UINTN\r
210EFIAPI\r
211UnicodeSPrintAsciiFormat (\r
212 OUT CHAR16 *StartOfBuffer,\r
213 IN UINTN BufferSize,\r
214 IN CONST CHAR8 *FormatString,\r
215 ...\r
216 );\r
217\r
218/**\r
219 Converts a decimal value to a Null-terminated Unicode string.\r
220 \r
221 Converts the decimal number specified by Value to a Null-terminated Unicode \r
222 string specified by Buffer containing at most Width characters. No padding of spaces \r
223 is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
224 The number of Unicode characters in Buffer is returned not including the Null-terminator.\r
225 If the conversion contains more than Width characters, then only the first\r
226 Width characters are returned, and the total number of characters \r
227 required to perform the conversion is returned.\r
228 Additional conversion parameters are specified in Flags. \r
229 \r
230 The Flags bit LEFT_JUSTIFY is always ignored.\r
231 All conversions are left justified in Buffer.\r
232 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
233 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
234 are inserted every 3rd digit starting from the right.\r
df8d0595 235 If RADIX_HEX is set in Flags, then the output buffer will be \r
3eb9473e 236 formatted in hexadecimal format.\r
df8d0595 237 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.\r
3eb9473e 238 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
239 then Buffer is padded with '0' characters so the combination of the optional '-' \r
240 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
241 add up to Width characters.\r
df8d0595 242 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r
3eb9473e 243 If Buffer is NULL, then ASSERT().\r
244 If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
245 If unsupported bits are set in Flags, then ASSERT().\r
df8d0595 246 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r
3eb9473e 247 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
248\r
249 @param Buffer Pointer to the output buffer for the produced Null-terminated\r
250 Unicode string.\r
251 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r
252 @param Value The 64-bit signed value to convert to a string.\r
253 @param Width The maximum number of Unicode characters to place in Buffer, not including\r
254 the Null-terminator.\r
255 \r
256 @return The number of Unicode characters in Buffer not including the Null-terminator.\r
257\r
258**/\r
259UINTN\r
260EFIAPI\r
261UnicodeValueToString (\r
262 IN OUT CHAR16 *Buffer,\r
263 IN UINTN Flags,\r
264 IN INT64 Value,\r
265 IN UINTN Width\r
266 );\r
267\r
268/**\r
269 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
270 ASCII format string and a VA_LIST argument list.\r
271 \r
272 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
273 and BufferSize.\r
274 The ASCII string is produced by parsing the format string specified by FormatString.\r
275 Arguments are pulled from the variable argument list specified by Marker based on \r
276 the contents of the format string.\r
277 The number of ASCII characters in the produced output buffer is returned not including\r
278 the Null-terminator.\r
279 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
280\r
281 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
282 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
283 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
284 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
285 ASSERT().\r
286 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
287 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
288 Null-terminator, then ASSERT().\r
289\r
290 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
291 ASCII string.\r
292 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
293 @param FormatString Null-terminated Unicode format string.\r
294 @param Marker VA_LIST marker for the variable argument list.\r
295 \r
296 @return The number of ASCII characters in the produced output buffer not including the\r
297 Null-terminator.\r
298\r
299**/\r
300UINTN\r
301EFIAPI\r
302AsciiVSPrint (\r
303 OUT CHAR8 *StartOfBuffer,\r
304 IN UINTN BufferSize,\r
305 IN CONST CHAR8 *FormatString,\r
306 IN VA_LIST Marker\r
307 );\r
308\r
309/**\r
310 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
311 ASCII format string and variable argument list.\r
312 \r
313 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
314 and BufferSize.\r
315 The ASCII string is produced by parsing the format string specified by FormatString.\r
316 Arguments are pulled from the variable argument list based on the contents of the \r
317 format string.\r
318 The number of ASCII characters in the produced output buffer is returned not including\r
319 the Null-terminator.\r
320 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
321\r
322 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
323 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
324 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
325 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
326 ASSERT().\r
327 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
328 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
329 Null-terminator, then ASSERT().\r
330\r
331 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
332 ASCII string.\r
333 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
334 @param FormatString Null-terminated Unicode format string.\r
335 \r
336 @return The number of ASCII characters in the produced output buffer not including the\r
337 Null-terminator.\r
338\r
339**/\r
340UINTN\r
341EFIAPI\r
342AsciiSPrint (\r
343 OUT CHAR8 *StartOfBuffer,\r
344 IN UINTN BufferSize,\r
345 IN CONST CHAR8 *FormatString,\r
346 ...\r
347 );\r
348\r
349/**\r
350 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
351 ASCII format string and a VA_LIST argument list.\r
352 \r
353 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
354 and BufferSize.\r
355 The ASCII string is produced by parsing the format string specified by FormatString.\r
356 Arguments are pulled from the variable argument list specified by Marker based on \r
357 the contents of the format string.\r
358 The number of ASCII characters in the produced output buffer is returned not including\r
359 the Null-terminator.\r
360 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
361\r
362 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
363 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
364 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
365 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
366 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
367 ASSERT().\r
368 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
369 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
370 Null-terminator, then ASSERT().\r
371\r
372 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
373 ASCII string.\r
374 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
375 @param FormatString Null-terminated Unicode format string.\r
376 @param Marker VA_LIST marker for the variable argument list.\r
377 \r
378 @return The number of ASCII characters in the produced output buffer not including the\r
379 Null-terminator.\r
380\r
381**/\r
382UINTN\r
383EFIAPI\r
384AsciiVSPrintUnicodeFormat (\r
385 OUT CHAR8 *StartOfBuffer,\r
386 IN UINTN BufferSize,\r
387 IN CONST CHAR16 *FormatString,\r
388 IN VA_LIST Marker\r
389 );\r
390\r
391/**\r
392 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
393 ASCII format string and variable argument list.\r
394 \r
395 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
396 and BufferSize.\r
397 The ASCII string is produced by parsing the format string specified by FormatString.\r
398 Arguments are pulled from the variable argument list based on the contents of the \r
399 format string.\r
400 The number of ASCII characters in the produced output buffer is returned not including\r
401 the Null-terminator.\r
402 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
403\r
404 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
405 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
406 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
407 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
408 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
409 ASSERT().\r
410 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
411 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
412 Null-terminator, then ASSERT().\r
413\r
414 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
415 ASCII string.\r
416 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
417 @param FormatString Null-terminated Unicode format string.\r
418 \r
419 @return The number of ASCII characters in the produced output buffer not including the\r
420 Null-terminator.\r
421\r
422**/\r
423UINTN\r
424EFIAPI\r
425AsciiSPrintUnicodeFormat (\r
426 OUT CHAR8 *StartOfBuffer,\r
427 IN UINTN BufferSize,\r
428 IN CONST CHAR16 *FormatString,\r
429 ...\r
430 );\r
431\r
432/**\r
433 Converts a decimal value to a Null-terminated ASCII string.\r
434 \r
435 Converts the decimal number specified by Value to a Null-terminated ASCII string \r
436 specified by Buffer containing at most Width characters. No padding of spaces \r
437 is ever performed.\r
438 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
439 The number of ASCII characters in Buffer is returned not including the Null-terminator.\r
440 If the conversion contains more than Width characters, then only the first Width\r
441 characters are returned, and the total number of characters required to perform\r
442 the conversion is returned.\r
443 Additional conversion parameters are specified in Flags. \r
444 The Flags bit LEFT_JUSTIFY is always ignored.\r
445 All conversions are left justified in Buffer.\r
446 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
447 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
448 are inserted every 3rd digit starting from the right.\r
df8d0595 449 If RADIX_HEX is set in Flags, then the output buffer will be \r
3eb9473e 450 formatted in hexadecimal format.\r
df8d0595 451 If Value is < 0 and RADIX_HEX is not set in Flags, then the fist character in Buffer is a '-'.\r
3eb9473e 452 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
453 then Buffer is padded with '0' characters so the combination of the optional '-' \r
454 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
455 add up to Width characters.\r
456 \r
457 If Buffer is NULL, then ASSERT().\r
458 If unsupported bits are set in Flags, then ASSERT().\r
df8d0595 459 If both COMMA_TYPE and RADIX_HEX are set in Flags, then ASSERT().\r
3eb9473e 460 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
461\r
462 @param Buffer Pointer to the output buffer for the produced Null-terminated\r
463 ASCII string.\r
464 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r
465 @param Value The 64-bit signed value to convert to a string.\r
466 @param Width The maximum number of ASCII characters to place in Buffer, not including\r
467 the Null-terminator.\r
468 \r
469 @return The number of ASCII characters in Buffer not including the Null-terminator.\r
470\r
471**/\r
472UINTN\r
473EFIAPI\r
474AsciiValueToString (\r
475 IN OUT CHAR8 *Buffer,\r
476 IN UINTN Flags,\r
477 IN INT64 Value,\r
478 IN UINTN Width\r
479 );\r
480\r
481#endif\r