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