]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | PrintLib.c\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | Print Library\r | |
19 | \r | |
20 | --*/\r | |
21 | \r | |
22 | \r | |
23 | \r | |
24 | static EFI_PRINT_PROTOCOL *gPrintProtocol = NULL;\r | |
25 | \r | |
26 | UINTN\r | |
27 | UnicodeVSPrint (\r | |
28 | OUT CHAR16 *StartOfBuffer,\r | |
29 | IN UINTN BufferSize,\r | |
30 | IN const CHAR16 *FormatString,\r | |
31 | IN VA_LIST Marker\r | |
32 | )\r | |
33 | /*++\r | |
34 | \r | |
35 | Routine Description:\r | |
36 | \r | |
37 | VSPrint function to process format and place the results in Buffer. Since a \r | |
38 | VA_LIST is used this rountine allows the nesting of Vararg routines. Thus \r | |
39 | this is the main print working routine\r | |
40 | \r | |
41 | Arguments:\r | |
42 | \r | |
43 | StartOfBuffer - Unicode buffer to print the results of the parsing of Format into.\r | |
44 | \r | |
45 | BufferSize - Maximum number of characters to put into buffer. Zero means \r | |
46 | no limit.\r | |
47 | \r | |
48 | FormatString - Unicode format string see file header for more details.\r | |
49 | \r | |
50 | Marker - Vararg list consumed by processing Format.\r | |
51 | \r | |
52 | Returns: \r | |
53 | \r | |
54 | Number of characters printed.\r | |
55 | \r | |
56 | --*/\r | |
57 | {\r | |
58 | EFI_STATUS Status;\r | |
59 | \r | |
60 | if (gPrintProtocol == NULL) {\r | |
61 | Status = gBS->LocateProtocol (\r | |
62 | &gEfiPrintProtocolGuid,\r | |
63 | NULL,\r | |
64 | (VOID **)&gPrintProtocol\r | |
65 | );\r | |
66 | if (EFI_ERROR (Status)) {\r | |
67 | gPrintProtocol = NULL;\r | |
68 | } \r | |
69 | if (gPrintProtocol == NULL) {\r | |
70 | return 0;\r | |
71 | }\r | |
72 | }\r | |
73 | return gPrintProtocol->VSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r | |
74 | }\r | |
75 | \r | |
76 | UINTN\r | |
77 | UnicodeSPrint (\r | |
78 | OUT CHAR16 *StartOfBuffer,\r | |
79 | IN UINTN BufferSize,\r | |
80 | IN const CHAR16 *FormatString,\r | |
81 | ...\r | |
82 | )\r | |
83 | \r | |
84 | {\r | |
85 | UINTN Return;\r | |
86 | VA_LIST Marker;\r | |
87 | \r | |
88 | VA_START (Marker, FormatString);\r | |
89 | Return = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r | |
90 | VA_END (Marker);\r | |
91 | return Return;\r | |
92 | }\r | |
93 | \r | |
94 | UINTN\r | |
95 | AsciiVSPrint (\r | |
96 | OUT CHAR8 *StartOfBuffer,\r | |
97 | IN UINTN BufferSize,\r | |
98 | IN const CHAR8 *FormatString,\r | |
99 | IN VA_LIST Marker\r | |
100 | )\r | |
101 | /*++\r | |
102 | \r | |
103 | Routine Description:\r | |
104 | \r | |
105 | VSPrint function to process format and place the results in Buffer. Since a \r | |
106 | VA_LIST is used this rountine allows the nesting of Vararg routines. Thus \r | |
107 | this is the main print working routine\r | |
108 | \r | |
109 | Arguments:\r | |
110 | \r | |
111 | StartOfBuffer - Unicode buffer to print the results of the parsing of Format into.\r | |
112 | \r | |
113 | BufferSize - Maximum number of characters to put into buffer. Zero means \r | |
114 | no limit.\r | |
115 | \r | |
116 | FormatString - Unicode format string see file header for more details.\r | |
117 | \r | |
118 | Marker - Vararg list consumed by processing Format.\r | |
119 | \r | |
120 | Returns: \r | |
121 | \r | |
122 | Number of characters printed.\r | |
123 | \r | |
124 | --*/\r | |
125 | {\r | |
126 | return 0;\r | |
127 | }\r | |
128 | \r | |
129 | UINTN\r | |
130 | AsciiSPrint (\r | |
131 | OUT CHAR8 *StartOfBuffer,\r | |
132 | IN UINTN BufferSize,\r | |
133 | IN const CHAR8 *FormatString,\r | |
134 | ...\r | |
135 | )\r | |
136 | \r | |
137 | {\r | |
138 | UINTN Return;\r | |
139 | VA_LIST Marker;\r | |
140 | \r | |
141 | VA_START (Marker, FormatString);\r | |
142 | Return = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);\r | |
143 | VA_END (Marker);\r | |
144 | return Return;\r | |
145 | }\r |