]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
2 | Print Library.\r | |
3 | \r | |
4 | Copyright (c) 2006, 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 | |
add13dc2 | 17 | #ifndef __PRINT_LIB_INTERNAL_H\r |
18 | #define __PRINT_LIB_INTERNAL_H\r | |
19 | \r | |
878ddf1f | 20 | //\r |
21 | // Print primitives\r | |
22 | //\r | |
23 | //#define LEFT_JUSTIFY 0x01\r | |
24 | #define PREFIX_SIGN 0x02\r | |
25 | #define PREFIX_BLANK 0x04\r | |
26 | //#define COMMA_TYPE 0x08\r | |
27 | #define LONG_TYPE 0x10\r | |
28 | //#define PREFIX_ZERO 0x20\r | |
29 | #define OUTPUT_UNICODE 0x40\r | |
30 | #define RADIX_HEX 0x80\r | |
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 | |
878ddf1f | 37 | //\r |
3f9f540d | 38 | // Record date and time information\r |
878ddf1f | 39 | //\r |
40 | typedef 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 | |
3f9f540d | 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 variable argument list.\r | |
57 | \r | |
58 | VSPrint function to process format and place the results in Buffer. Since a \r | |
59 | VA_LIST is used this rountine allows the nesting of Vararg routines. Thus \r | |
60 | this is the main print working routine\r | |
61 | \r | |
62 | @param Buffer Character buffer to print the results of the parsing\r | |
63 | of Format into.\r | |
64 | @param BufferSize Maximum number of characters to put into buffer.\r | |
65 | Zero means no limit.\r | |
66 | @param Flags Intial flags value.\r | |
67 | Can only have FORMAT_UNICODE and OUTPUT_UNICODE set\r | |
68 | @param FormatString Null-terminated format string.\r | |
69 | \r | |
70 | @return Number of characters printed.\r | |
71 | \r | |
72 | **/\r | |
878ddf1f | 73 | UINTN\r |
74 | BasePrintLibSPrint (\r | |
75 | OUT CHAR8 *Buffer,\r | |
76 | IN UINTN BufferSize,\r | |
77 | IN UINTN Flags,\r | |
78 | IN CONST CHAR8 *FormatString,\r | |
79 | ...\r | |
80 | );\r | |
81 | \r | |
3f9f540d | 82 | /**\r |
83 | Internal function that places the character into the Buffer.\r | |
84 | \r | |
85 | Internal function that places ASCII or Unicode character into the Buffer.\r | |
86 | \r | |
87 | @param Buffer Buffer to place the Unicode or ASCII string.\r | |
4f7f1f5f | 88 | @param EndBuffer The end of the input Buffer. No characters will be\r |
89 | placed after that. \r | |
3f9f540d | 90 | @param Length Count of character to be placed into Buffer.\r |
91 | @param Character Character to be placed into Buffer.\r | |
92 | @param Increment Character increment in Buffer.\r | |
93 | \r | |
94 | @return Number of characters printed.\r | |
95 | \r | |
96 | **/\r | |
878ddf1f | 97 | CHAR8 *\r |
98 | BasePrintLibFillBuffer (\r | |
99 | CHAR8 *Buffer,\r | |
4f7f1f5f | 100 | CHAR8 *EndBuffer,\r |
878ddf1f | 101 | INTN Length,\r |
102 | UINTN Character,\r | |
103 | INTN Increment\r | |
104 | );\r | |
105 | \r | |
3f9f540d | 106 | /**\r |
107 | Internal function that convert a decimal number to a string in Buffer.\r | |
108 | \r | |
109 | Print worker function that convert a decimal number to a string in Buffer.\r | |
110 | \r | |
111 | @param Buffer Location to place the Unicode or ASCII string of Value.\r | |
112 | @param Value Value to convert to a Decimal or Hexidecimal string in Buffer.\r | |
113 | @param Radix Radix of the value\r | |
114 | \r | |
115 | @return Number of characters printed.\r | |
116 | \r | |
117 | **/\r | |
878ddf1f | 118 | UINTN\r |
119 | EFIAPI\r | |
120 | BasePrintLibValueToString (\r | |
121 | IN OUT CHAR8 *Buffer, \r | |
122 | IN INT64 Value, \r | |
123 | IN UINTN Radix\r | |
124 | );\r | |
125 | \r | |
3f9f540d | 126 | /**\r |
127 | Internal function that converts a decimal value to a Null-terminated string.\r | |
128 | \r | |
129 | Converts the decimal number specified by Value to a Null-terminated \r | |
130 | string specified by Buffer containing at most Width characters.\r | |
131 | If Width is 0 then a width of MAXIMUM_VALUE_CHARACTERS is assumed.\r | |
132 | The total number of characters placed in Buffer is returned.\r | |
133 | If the conversion contains more than Width characters, then only the first\r | |
134 | Width characters are returned, and the total number of characters \r | |
135 | required to perform the conversion is returned.\r | |
136 | Additional conversion parameters are specified in Flags. \r | |
137 | The Flags bit LEFT_JUSTIFY is always ignored.\r | |
138 | All conversions are left justified in Buffer.\r | |
139 | If Width is 0, PREFIX_ZERO is ignored in Flags.\r | |
140 | If COMMA_TYPE is set in Flags, then PREFIX_ZERO is ignored in Flags, and commas\r | |
141 | are inserted every 3rd digit starting from the right.\r | |
142 | If Value is < 0, then the fist character in Buffer is a '-'.\r | |
143 | If PREFIX_ZERO is set in Flags and PREFIX_ZERO is not being ignored, \r | |
144 | then Buffer is padded with '0' characters so the combination of the optional '-' \r | |
145 | sign character, '0' characters, digit characters for Value, and the Null-terminator\r | |
146 | add up to Width characters.\r | |
147 | \r | |
148 | If Buffer is NULL, then ASSERT().\r | |
149 | If unsupported bits are set in Flags, then ASSERT().\r | |
150 | If Width >= MAXIMUM_VALUE_CHARACTERS, then ASSERT()\r | |
151 | \r | |
152 | @param Buffer Pointer to the output buffer for the produced Null-terminated\r | |
153 | string.\r | |
154 | @param Flags The bitmask of flags that specify left justification, zero pad,\r | |
155 | and commas.\r | |
156 | @param Value The 64-bit signed value to convert to a string.\r | |
4f7f1f5f | 157 | @param Width The maximum number of characters to place in Buffer, not including\r |
158 | the Null-terminator.\r | |
3f9f540d | 159 | @param Increment Character increment in Buffer.\r |
160 | \r | |
161 | @return Total number of characters required to perform the conversion.\r | |
162 | \r | |
163 | **/\r | |
a3657e3e | 164 | UINTN\r |
165 | BasePrintLibConvertValueToString (\r | |
166 | IN OUT CHAR8 *Buffer,\r | |
167 | IN UINTN Flags,\r | |
168 | IN INT64 Value,\r | |
169 | IN UINTN Width,\r | |
170 | IN UINTN Increment\r | |
171 | );\r | |
add13dc2 | 172 | \r |
173 | #endif\r |