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