]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BasePrintLib/PrintLibInternal.h
Minor grammatical work--mostly adding periods. Items with ONLY period added did...
[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
19388d29
HT
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
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
e1f414b6 27#define PREFIX_SIGN 0x02\r
28#define PREFIX_BLANK 0x04\r
e1f414b6 29#define LONG_TYPE 0x10\r
e1f414b6 30#define OUTPUT_UNICODE 0x40\r
e1f414b6 31#define FORMAT_UNICODE 0x100\r
32#define PAD_TO_WIDTH 0x200\r
33#define ARGUMENT_UNICODE 0x400\r
34#define PRECISION 0x800\r
35#define ARGUMENT_REVERSED 0x1000\r
36\r
37//\r
38// Record date and time information\r
39//\r
40typedef struct {\r
41 UINT16 Year;\r
42 UINT8 Month;\r
43 UINT8 Day;\r
44 UINT8 Hour;\r
45 UINT8 Minute;\r
46 UINT8 Second;\r
47 UINT8 Pad1;\r
48 UINT32 Nanosecond;\r
49 INT16 TimeZone;\r
50 UINT8 Daylight;\r
51 UINT8 Pad2;\r
52} TIME;\r
53\r
54/**\r
55 Worker function that produces a Null-terminated string in an output buffer \r
56 based on a Null-terminated format string and a VA_LIST argument list.\r
57\r
58 VSPrint function to process format and place the results in Buffer. Since a \r
7c905091 59 VA_LIST is used this routine allows the nesting of Vararg routines. Thus \r
e1f414b6 60 this is the main print working routine.\r
61\r
2fc59a00 62 @param Buffer The character buffer to print the results of the parsing\r
2075236e 63 of Format into.\r
2fc59a00 64 @param BufferSize The maximum number of characters to put into buffer.\r
2075236e 65 @param Flags Initial flags value.\r
66 Can only have FORMAT_UNICODE and OUTPUT_UNICODE set.\r
2fc59a00 67 @param Format A Null-terminated format string.\r
2075236e 68 @param VaListMarker VA_LIST style variable argument list consumed by processing Format.\r
69 @param BaseListMarker BASE_LIST style variable argument list consumed by processing Format.\r
e1f414b6 70\r
2fc59a00 71 @return The number of characters printed not including the Null-terminator.\r
e1f414b6 72\r
73**/\r
74UINTN\r
2075236e 75BasePrintLibSPrintMarker (\r
e1f414b6 76 OUT CHAR8 *Buffer,\r
77 IN UINTN BufferSize,\r
78 IN UINTN Flags,\r
79 IN CONST CHAR8 *Format,\r
2075236e 80 IN VA_LIST VaListMarker, OPTIONAL\r
81 IN BASE_LIST BaseListMarker OPTIONAL\r
e1f414b6 82 );\r
83\r
84/**\r
85 Worker function that produces a Null-terminated string in an output buffer \r
86 based on a Null-terminated format string and variable argument list.\r
87\r
88 VSPrint function to process format and place the results in Buffer. Since a \r
7c905091 89 VA_LIST is used this routine allows the nesting of Vararg routines. Thus \r
e1f414b6 90 this is the main print working routine\r
91\r
2fc59a00 92 @param StartOfBuffer The character buffer to print the results of the parsing\r
e1f414b6 93 of Format into.\r
2fc59a00 94 @param BufferSize The maximum number of characters to put into buffer.\r
e1f414b6 95 Zero means no limit.\r
7c905091 96 @param Flags Initial flags value.\r
e1f414b6 97 Can only have FORMAT_UNICODE and OUTPUT_UNICODE set\r
98 @param FormatString Null-terminated format string.\r
eceb3a4c 99 @param ... The variable argument list.\r
e1f414b6 100\r
2fc59a00 101 @return The number of characters printed.\r
e1f414b6 102\r
103**/\r
104UINTN\r
932d66a9 105EFIAPI\r
e1f414b6 106BasePrintLibSPrint (\r
eceb3a4c 107 OUT CHAR8 *StartOfBuffer,\r
e1f414b6 108 IN UINTN BufferSize,\r
109 IN UINTN Flags,\r
110 IN CONST CHAR8 *FormatString,\r
111 ...\r
112 );\r
113\r
114/**\r
115 Internal function that places the character into the Buffer.\r
116\r
117 Internal function that places ASCII or Unicode character into the Buffer.\r
118\r
119 @param Buffer Buffer to place the Unicode or ASCII string.\r
120 @param EndBuffer The end of the input Buffer. No characters will be\r
121 placed after that. \r
2fc59a00 122 @param Length The count of character to be placed into Buffer.\r
a2bc29c4 123 (Negative value indicates no buffer fill.)\r
2fc59a00 124 @param Character The character to be placed into Buffer.\r
125 @param Increment The character increment in Buffer.\r
e1f414b6 126\r
eceb3a4c 127 @return Buffer Buffer filled with the input Character.\r
e1f414b6 128\r
129**/\r
130CHAR8 *\r
131BasePrintLibFillBuffer (\r
eceb3a4c
LG
132 OUT CHAR8 *Buffer,\r
133 IN CHAR8 *EndBuffer,\r
134 IN INTN Length,\r
135 IN UINTN Character,\r
136 IN INTN Increment\r
e1f414b6 137 );\r
138\r
139/**\r
7c905091 140 Internal function that convert a number to a string in Buffer.\r
e1f414b6 141\r
7c905091 142 Print worker function that converts a decimal or hexadecimal number to an ASCII string in Buffer.\r
e1f414b6 143\r
7c905091 144 @param Buffer Location to place the ASCII string of Value.\r
2fc59a00 145 @param Value The value to convert to a Decimal or Hexadecimal string in Buffer.\r
e1f414b6 146 @param Radix Radix of the value\r
147\r
7c905091 148 @return A pointer to the end of buffer filled with ASCII string.\r
e1f414b6 149\r
150**/\r
7c905091 151CHAR8 *\r
e1f414b6 152BasePrintLibValueToString (\r
153 IN OUT CHAR8 *Buffer, \r
154 IN INT64 Value, \r
155 IN UINTN Radix\r
156 );\r
157\r
158/**\r
159 Internal function that converts a decimal value to a Null-terminated string.\r
160 \r
161 Converts the decimal number specified by Value to a Null-terminated \r
162 string specified by Buffer containing at most Width characters.\r
163 If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r
164 The total number of characters placed in Buffer is returned.\r
165 If the conversion contains more than Width characters, then only the first\r
166 Width characters are returned, and the total number of characters \r
167 required to perform the conversion is returned.\r
168 Additional conversion parameters are specified in Flags. \r
169 The Flags bit LEFT_JUSTIFY is always ignored.\r
170 All conversions are left justified in Buffer.\r
171 If Width is 0, PREFIX_ZERO is ignored in Flags.\r
172 If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r
173 are inserted every 3rd digit starting from the right.\r
174 If Value is < 0, then the fist character in Buffer is a '-'.\r
175 If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r
176 then Buffer is padded with '0' characters so the combination of the optional '-' \r
177 sign character, '0' characters, digit characters for Value, and the Null-terminator\r
178 add up to Width characters.\r
179\r
180 If Buffer is NULL, then ASSERT().\r
181 If unsupported bits are set in Flags, then ASSERT().\r
182 If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r
183\r
2fc59a00 184 @param Buffer The pointer to the output buffer for the produced Null-terminated\r
e1f414b6 185 string.\r
186 @param Flags The bitmask of flags that specify left justification, zero pad,\r
187 and commas.\r
188 @param Value The 64-bit signed value to convert to a string.\r
189 @param Width The maximum number of characters to place in Buffer, not including\r
190 the Null-terminator.\r
191 @param Increment Character increment in Buffer.\r
192 \r
193 @return Total number of characters required to perform the conversion.\r
194\r
195**/\r
196UINTN\r
197BasePrintLibConvertValueToString (\r
198 IN OUT CHAR8 *Buffer,\r
199 IN UINTN Flags,\r
200 IN INT64 Value,\r
201 IN UINTN Width,\r
202 IN UINTN Increment\r
203 );\r
204\r
205#endif\r