]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BasePrintLib/PrintLibInternal.h
MdePkg: Update Base.h to fix compilation issues with ICC.
[mirror_edk2.git] / MdePkg / Library / BasePrintLib / PrintLibInternal.h
CommitLineData
e1f414b6 1/** @file\r
eceb3a4c 2 Base Print Library instance Internal Functions definition.\r
e1f414b6 3\r
9ade4339 4 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
19388d29 5 This program and the accompanying materials\r
e1f414b6 6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
2fc59a00 8 http://opensource.org/licenses/bsd-license.php.\r
e1f414b6 9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
e1f414b6 13**/\r
14\r
eceb3a4c
LG
15#ifndef __PRINT_LIB_INTERNAL_H__\r
16#define __PRINT_LIB_INTERNAL_H__\r
e1f414b6 17\r
f734a10a
A
18#include <Base.h>\r
19#include <Library/PrintLib.h>\r
20#include <Library/BaseLib.h>\r
21#include <Library/DebugLib.h>\r
22\r
e1f414b6 23\r
24//\r
25// Print primitives\r
26//\r
f405c067 27#define PREFIX_SIGN BIT1\r
28#define PREFIX_BLANK BIT2\r
29#define LONG_TYPE BIT4\r
30#define OUTPUT_UNICODE BIT6\r
31#define FORMAT_UNICODE BIT8\r
32#define PAD_TO_WIDTH BIT9\r
33#define ARGUMENT_UNICODE BIT10\r
34#define PRECISION BIT11\r
35#define ARGUMENT_REVERSED BIT12\r
36#define COUNT_ONLY_NO_PRINT BIT13\r
9ade4339 37#define UNSIGNED_TYPE BIT14\r
e1f414b6 38\r
39//\r
40// Record date and time information\r
41//\r
42typedef struct {\r
43 UINT16 Year;\r
44 UINT8 Month;\r
45 UINT8 Day;\r
46 UINT8 Hour;\r
47 UINT8 Minute;\r
48 UINT8 Second;\r
49 UINT8 Pad1;\r
50 UINT32 Nanosecond;\r
51 INT16 TimeZone;\r
52 UINT8 Daylight;\r
53 UINT8 Pad2;\r
54} TIME;\r
55\r
56/**\r
57 Worker function that produces a Null-terminated string in an output buffer \r
58 based on a Null-terminated format string and a VA_LIST argument list.\r
59\r
60 VSPrint function to process format and place the results in Buffer. Since a \r
7c905091 61 VA_LIST is used this routine allows the nesting of Vararg routines. Thus \r
e1f414b6 62 this is the main print working routine.\r
63\r
f405c067 64 If COUNT_ONLY_NO_PRINT is set in Flags, Buffer will not be modified at all.\r
65\r
66 @param[out] Buffer The character buffer to print the results of the \r
67 parsing of Format into.\r
68 @param[in] BufferSize The maximum number of characters to put into \r
69 buffer.\r
70 @param[in] Flags Initial flags value.\r
71 Can only have FORMAT_UNICODE, OUTPUT_UNICODE, \r
72 and COUNT_ONLY_NO_PRINT set.\r
73 @param[in] Format A Null-terminated format string.\r
74 @param[in] VaListMarker VA_LIST style variable argument list consumed by\r
75 processing Format.\r
76 @param[in] BaseListMarker BASE_LIST style variable argument list consumed\r
77 by processing Format.\r
e1f414b6 78\r
2fc59a00 79 @return The number of characters printed not including the Null-terminator.\r
f405c067 80 If COUNT_ONLY_NO_PRINT was set returns the same, but without any\r
81 modification to Buffer.\r
e1f414b6 82\r
83**/\r
84UINTN\r
2075236e 85BasePrintLibSPrintMarker (\r
e1f414b6 86 OUT CHAR8 *Buffer,\r
87 IN UINTN BufferSize,\r
88 IN UINTN Flags,\r
89 IN CONST CHAR8 *Format,\r
2075236e 90 IN VA_LIST VaListMarker, OPTIONAL\r
91 IN BASE_LIST BaseListMarker OPTIONAL\r
e1f414b6 92 );\r
93\r
94/**\r
95 Worker function that produces a Null-terminated string in an output buffer \r
96 based on a Null-terminated format string and variable argument list.\r
97\r
98 VSPrint function to process format and place the results in Buffer. Since a \r
7c905091 99 VA_LIST is used this routine allows the nesting of Vararg routines. Thus \r
e1f414b6 100 this is the main print working routine\r
101\r
2fc59a00 102 @param StartOfBuffer The character buffer to print the results of the parsing\r
e1f414b6 103 of Format into.\r
2fc59a00 104 @param BufferSize The maximum number of characters to put into buffer.\r
e1f414b6 105 Zero means no limit.\r
7c905091 106 @param Flags Initial flags value.\r
e1f414b6 107 Can only have FORMAT_UNICODE and OUTPUT_UNICODE set\r
108 @param FormatString Null-terminated format string.\r
eceb3a4c 109 @param ... The variable argument list.\r
e1f414b6 110\r
2fc59a00 111 @return The number of characters printed.\r
e1f414b6 112\r
113**/\r
114UINTN\r
932d66a9 115EFIAPI\r
e1f414b6 116BasePrintLibSPrint (\r
eceb3a4c 117 OUT CHAR8 *StartOfBuffer,\r
e1f414b6 118 IN UINTN BufferSize,\r
119 IN UINTN Flags,\r
120 IN CONST CHAR8 *FormatString,\r
121 ...\r
122 );\r
123\r
124/**\r
125 Internal function that places the character into the Buffer.\r
126\r
127 Internal function that places ASCII or Unicode character into the Buffer.\r
128\r
129 @param Buffer Buffer to place the Unicode or ASCII string.\r
130 @param EndBuffer The end of the input Buffer. No characters will be\r
131 placed after that. \r
2fc59a00 132 @param Length The count of character to be placed into Buffer.\r
a2bc29c4 133 (Negative value indicates no buffer fill.)\r
2fc59a00 134 @param Character The character to be placed into Buffer.\r
135 @param Increment The character increment in Buffer.\r
e1f414b6 136\r
eceb3a4c 137 @return Buffer Buffer filled with the input Character.\r
e1f414b6 138\r
139**/\r
140CHAR8 *\r
141BasePrintLibFillBuffer (\r
eceb3a4c
LG
142 OUT CHAR8 *Buffer,\r
143 IN CHAR8 *EndBuffer,\r
144 IN INTN Length,\r
145 IN UINTN Character,\r
146 IN INTN Increment\r
e1f414b6 147 );\r
148\r
149/**\r
7c905091 150 Internal function that convert a number to a string in Buffer.\r
e1f414b6 151\r
7c905091 152 Print worker function that converts a decimal or hexadecimal number to an ASCII string in Buffer.\r
e1f414b6 153\r
7c905091 154 @param Buffer Location to place the ASCII string of Value.\r
2fc59a00 155 @param Value The value to convert to a Decimal or Hexadecimal string in Buffer.\r
e1f414b6 156 @param Radix Radix of the value\r
157\r
7c905091 158 @return A pointer to the end of buffer filled with ASCII string.\r
e1f414b6 159\r
160**/\r
7c905091 161CHAR8 *\r
e1f414b6 162BasePrintLibValueToString (\r
163 IN OUT CHAR8 *Buffer, \r
164 IN INT64 Value, \r
165 IN UINTN Radix\r
166 );\r
167\r
168/**\r
169 Internal function that converts a decimal value to a Null-terminated string.\r
170 \r
171 Converts the decimal number specified by Value to a Null-terminated \r
172 string specified by Buffer containing at most Width characters.\r
173 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
174 The total number of characters placed in Buffer is returned.\r
175 If the conversion contains more than Width characters, then only the first\r
176 Width characters are returned, and the total number of characters \r
177 required to perform the conversion is returned.\r
178 Additional conversion parameters are specified in Flags. \r
179 The Flags bit LEFT_JUSTIFY is always ignored.\r
180 All conversions are left justified in Buffer.\r
181 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
182 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
183 are inserted every 3rd digit starting from the right.\r
184 If Value is < 0, then the fist character in Buffer is a '-'.\r
185 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
186 then Buffer is padded with '0' characters so the combination of the optional '-' \r
187 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
188 add up to Width characters.\r
189\r
190 If Buffer is NULL, then ASSERT().\r
191 If unsupported bits are set in Flags, then ASSERT().\r
192 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
193\r
2fc59a00 194 @param Buffer The pointer to the output buffer for the produced Null-terminated\r
e1f414b6 195 string.\r
196 @param Flags The bitmask of flags that specify left justification, zero pad,\r
197 and commas.\r
198 @param Value The 64-bit signed value to convert to a string.\r
199 @param Width The maximum number of characters to place in Buffer, not including\r
200 the Null-terminator.\r
201 @param Increment Character increment in Buffer.\r
202 \r
203 @return Total number of characters required to perform the conversion.\r
204\r
205**/\r
206UINTN\r
207BasePrintLibConvertValueToString (\r
208 IN OUT CHAR8 *Buffer,\r
209 IN UINTN Flags,\r
210 IN INT64 Value,\r
211 IN UINTN Width,\r
212 IN UINTN Increment\r
213 );\r
214\r
215#endif\r