]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Protocol/Print2.h
Global variables have been moved backward ahead of functions.
[mirror_edk2.git] / MdeModulePkg / Include / Protocol / Print2.h
CommitLineData
217697af 1/** @file\r
2\r
3 This print protocol defines six basic print functions to \r
4 print the format unicode and ascii string.\r
5\r
6Copyright (c) 2006 - 2008, Intel Corporation\r
7All rights reserved. This program and the accompanying materials\r
8are licensed and made available under the terms and conditions of the BSD License\r
9which accompanies this distribution. The full text of the license may be found at\r
10http://opensource.org/licenses/bsd-license.php\r
11\r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#ifndef __PPRINT2_H__\r
18#define __PPRINT2_H__\r
19\r
2b4d6ac8 20#define EFI_PRINT2_PROTOCOL_GUID \\r
217697af 21 { 0x5bcc3dbc, 0x8c57, 0x450a, { 0xbb, 0xc, 0xa1, 0xc0, 0xbd, 0xde, 0x48, 0xc } }\r
22\r
23//\r
24// Forward reference for pure ANSI compatability\r
25//\r
26typedef struct _EFI_PRINT2_PROTOCOL EFI_PRINT2_PROTOCOL;\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 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
62typedef\r
63UINTN\r
64(EFIAPI *UNI_VSPRINT2)(\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/**\r
72 Produces a Null-terminated Unicode string in an output buffer based on a Null-terminated\r
73 ASCII format string and a VA_LIST argument list\r
74 \r
75 Produces a Null-terminated Unicode string in the output buffer specified by StartOfBuffer\r
76 and BufferSize.\r
77 The Unicode string is produced by parsing the format string specified by FormatString.\r
78 Arguments are pulled from the variable argument list specified by Marker based on the \r
79 contents of the format string.\r
80 The number of Unicode characters in the produced output buffer is returned not including\r
81 the Null-terminator.\r
82 If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned.\r
83\r
84 If BufferSize > 1 and StartOfBuffer is NULL, then ASSERT().\r
85 If BufferSize > 1 and StartOfBuffer is not aligned on a 16-bit boundary, then ASSERT().\r
86 If BufferSize > 1 and FormatString is NULL, then ASSERT().\r
87 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
88 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
89 ASSERT().\r
90 If PcdMaximumUnicodeStringLength is not zero, and produced Null-terminated Unicode string\r
91 contains more than PcdMaximumUnicodeStringLength Unicode characters not including the\r
92 Null-terminator, then ASSERT().\r
93\r
94 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
95 Unicode string.\r
96 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
97 @param FormatString Null-terminated Unicode format string.\r
98 @param Marker VA_LIST marker for the variable argument list.\r
99 \r
100 @return The number of Unicode characters in the produced output buffer not including the\r
101 Null-terminator.\r
102\r
103**/\r
104typedef\r
105UINTN\r
106(EFIAPI *UNI_VSPRINT_ASCII)(\r
107 OUT CHAR16 *StartOfBuffer,\r
108 IN UINTN BufferSize,\r
109 IN CONST CHAR8 *FormatString,\r
110 IN VA_LIST Marker\r
111 );\r
112\r
113/**\r
114 Converts a decimal value to a Null-terminated Unicode string.\r
115 \r
116 Converts the decimal number specified by Value to a Null-terminated Unicode \r
117 string specified by Buffer containing at most Width characters. No padding of spaces \r
118 is ever performed. If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
119 The number of Unicode characters in Buffer is returned not including the Null-terminator.\r
120 If the conversion contains more than Width characters, then only the first\r
121 Width characters are returned, and the total number of characters \r
122 required to perform the conversion is returned.\r
123 Additional conversion parameters are specified in Flags. \r
124 \r
125 The Flags bit LEFT_JUSTIFY is always ignored.\r
126 All conversions are left justified in Buffer.\r
127 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
128 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
129 are inserted every 3rd digit starting from the right.\r
130 If HEX_RADIX is set in Flags, then the output buffer will be \r
131 formatted in hexadecimal format.\r
132 If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.\r
133 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
134 then Buffer is padded with '0' characters so the combination of the optional '-' \r
135 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
136 add up to Width characters.\r
137 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r
138 If Buffer is NULL, then ASSERT().\r
139 If Buffer is not aligned on a 16-bit boundary, then ASSERT().\r
140 If unsupported bits are set in Flags, then ASSERT().\r
141 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r
142 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
143\r
144 @param Buffer Pointer to the output buffer for the produced Null-terminated\r
145 Unicode string.\r
146 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r
147 @param Value The 64-bit signed value to convert to a string.\r
148 @param Width The maximum number of Unicode characters to place in Buffer, not including\r
149 the Null-terminator.\r
150 \r
151 @return The number of Unicode characters in Buffer not including the Null-terminator.\r
152\r
153**/\r
154typedef\r
155UINTN\r
156(EFIAPI *VALUE_TO_UNISTRING)(\r
157 IN OUT CHAR16 *Buffer,\r
158 IN UINTN Flags,\r
159 IN INT64 Value,\r
160 IN UINTN Width\r
161 );\r
162\r
163/**\r
164 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
165 ASCII format string and a VA_LIST argument list.\r
166 \r
167 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
168 and BufferSize.\r
169 The ASCII string is produced by parsing the format string specified by FormatString.\r
170 Arguments are pulled from the variable argument list specified by Marker based on \r
171 the contents of the format string.\r
172 The number of ASCII characters in the produced output buffer is returned not including\r
173 the Null-terminator.\r
174 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
175\r
176 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
177 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
178 If PcdMaximumAsciiStringLength is not zero, and FormatString contains more than\r
179 PcdMaximumAsciiStringLength ASCII characters not including the Null-terminator, then\r
180 ASSERT().\r
181 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
182 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
183 Null-terminator, then ASSERT().\r
184\r
185 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
186 ASCII string.\r
187 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
188 @param FormatString Null-terminated Unicode format string.\r
189 @param Marker VA_LIST marker for the variable argument list.\r
190 \r
191 @return The number of ASCII characters in the produced output buffer not including the\r
192 Null-terminator.\r
193\r
194**/\r
195typedef\r
196UINTN\r
197(EFIAPI *ASCII_VSPRINT)(\r
198 OUT CHAR8 *StartOfBuffer,\r
199 IN UINTN BufferSize,\r
200 IN CONST CHAR8 *FormatString,\r
201 IN VA_LIST Marker\r
202 );\r
203\r
204/**\r
205 Produces a Null-terminated ASCII string in an output buffer based on a Null-terminated\r
206 ASCII format string and a VA_LIST argument list.\r
207 \r
208 Produces a Null-terminated ASCII string in the output buffer specified by StartOfBuffer\r
209 and BufferSize.\r
210 The ASCII string is produced by parsing the format string specified by FormatString.\r
211 Arguments are pulled from the variable argument list specified by Marker based on \r
212 the contents of the format string.\r
213 The number of ASCII characters in the produced output buffer is returned not including\r
214 the Null-terminator.\r
215 If BufferSize is 0, then no output buffer is produced and 0 is returned.\r
216\r
217 If BufferSize > 0 and StartOfBuffer is NULL, then ASSERT().\r
218 If BufferSize > 0 and FormatString is NULL, then ASSERT().\r
219 If BufferSize > 0 and FormatString is not aligned on a 16-bit boundary, then ASSERT().\r
220 If PcdMaximumUnicodeStringLength is not zero, and FormatString contains more than\r
221 PcdMaximumUnicodeStringLength Unicode characters not including the Null-terminator, then\r
222 ASSERT().\r
223 If PcdMaximumAsciiStringLength is not zero, and produced Null-terminated ASCII string\r
224 contains more than PcdMaximumAsciiStringLength ASCII characters not including the\r
225 Null-terminator, then ASSERT().\r
226\r
227 @param StartOfBuffer A pointer to the output buffer for the produced Null-terminated \r
228 ASCII string.\r
229 @param BufferSize The size, in bytes, of the output buffer specified by StartOfBuffer.\r
230 @param FormatString Null-terminated Unicode format string.\r
231 @param Marker VA_LIST marker for the variable argument list.\r
232 \r
233 @return The number of ASCII characters in the produced output buffer not including the\r
234 Null-terminator.\r
235\r
236**/\r
237typedef\r
238UINTN\r
239(EFIAPI *ASCII_VSPRINT_UNI)(\r
240 OUT CHAR8 *StartOfBuffer,\r
241 IN UINTN BufferSize,\r
242 IN CONST CHAR16 *FormatString,\r
243 IN VA_LIST Marker\r
244 );\r
245\r
246/**\r
247 Converts a decimal value to a Null-terminated ASCII string.\r
248 \r
249 Converts the decimal number specified by Value to a Null-terminated ASCII string \r
250 specified by Buffer containing at most Width characters. No padding of spaces \r
251 is ever performed.\r
252 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
253 The number of ASCII characters in Buffer is returned not including the Null-terminator.\r
254 If the conversion contains more than Width characters, then only the first Width\r
255 characters are returned, and the total number of characters required to perform\r
256 the conversion is returned.\r
257 Additional conversion parameters are specified in Flags. \r
258 The Flags bit LEFT_JUSTIFY is always ignored.\r
259 All conversions are left justified in Buffer.\r
260 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
261 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
262 are inserted every 3rd digit starting from the right.\r
263 If HEX_RADIX is set in Flags, then the output buffer will be \r
264 formatted in hexadecimal format.\r
265 If Value is < 0 and HEX_RADIX is not set in Flags, then the fist character in Buffer is a '-'.\r
266 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
267 then Buffer is padded with '0' characters so the combination of the optional '-' \r
268 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
269 add up to Width characters.\r
270 \r
271 If Buffer is NULL, then ASSERT().\r
272 If unsupported bits are set in Flags, then ASSERT().\r
273 If both COMMA_TYPE and HEX_RADIX are set in Flags, then ASSERT().\r
274 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
275\r
276 @param Buffer Pointer to the output buffer for the produced Null-terminated\r
277 ASCII string.\r
278 @param Flags The bitmask of flags that specify left justification, zero pad, and commas.\r
279 @param Value The 64-bit signed value to convert to a string.\r
280 @param Width The maximum number of ASCII characters to place in Buffer, not including\r
281 the Null-terminator.\r
282 \r
283 @return The number of ASCII characters in Buffer not including the Null-terminator.\r
284\r
285**/\r
286typedef\r
287UINTN\r
288(EFIAPI *VALUE_TO_ASCIISTRING)(\r
289 IN OUT CHAR8 *Buffer,\r
290 IN UINTN Flags,\r
291 IN INT64 Value,\r
292 IN UINTN Width\r
293 );\r
294\r
295struct _EFI_PRINT2_PROTOCOL {\r
296 UNI_VSPRINT2 VSPrint;\r
297 UNI_VSPRINT_ASCII UniVSPrintAscii;\r
298 VALUE_TO_UNISTRING UniValueToString; \r
299 ASCII_VSPRINT AsciiVSPrint; \r
300 ASCII_VSPRINT_UNI AsciiVSPrintUni;\r
301 VALUE_TO_ASCIISTRING AsciiValueToString;\r
302};\r
303\r
304extern EFI_GUID gEfiPrint2ProtocolGuid;\r
305\r
306#endif\r