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