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