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