]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/EdkDxePrintLib/PrintLib.c
Fix ICC build error
[mirror_edk2.git] / MdeModulePkg / Library / EdkDxePrintLib / PrintLib.c
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. 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 Module Name:
13
14 PrintLib.c
15
16 Abstract:
17
18 Print Library
19
20 --*/
21
22
23
24
25 #include <PiDxe.h>
26
27 #include <Protocol/Print.h>
28
29 #include <Library/PrintLib.h>
30 #include <Library/UefiBootServicesTableLib.h>
31
32 static EFI_PRINT_PROTOCOL *gPrintProtocol = NULL;
33
34 UINTN
35 UnicodeVSPrint (
36 OUT CHAR16 *StartOfBuffer,
37 IN UINTN BufferSize,
38 IN const CHAR16 *FormatString,
39 IN VA_LIST Marker
40 )
41 /*++
42
43 Routine Description:
44
45 VSPrint function to process format and place the results in Buffer. Since a
46 VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
47 this is the main print working routine
48
49 Arguments:
50
51 StartOfBuffer - Unicode buffer to print the results of the parsing of Format into.
52
53 BufferSize - Maximum number of characters to put into buffer. Zero means
54 no limit.
55
56 FormatString - Unicode format string see file header for more details.
57
58 Marker - Vararg list consumed by processing Format.
59
60 Returns:
61
62 Number of characters printed.
63
64 --*/
65 {
66 EFI_STATUS Status;
67
68 if (gPrintProtocol == NULL) {
69 Status = gBS->LocateProtocol (
70 &gEfiPrintProtocolGuid,
71 NULL,
72 (VOID **)&gPrintProtocol
73 );
74 if (EFI_ERROR (Status)) {
75 gPrintProtocol = NULL;
76 }
77 if (gPrintProtocol == NULL) {
78 return 0;
79 }
80 }
81 return gPrintProtocol->VSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
82 }
83
84 UINTN
85 UnicodeSPrint (
86 OUT CHAR16 *StartOfBuffer,
87 IN UINTN BufferSize,
88 IN const CHAR16 *FormatString,
89 ...
90 )
91
92 {
93 UINTN Return;
94 VA_LIST Marker;
95
96 VA_START (Marker, FormatString);
97 Return = UnicodeVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
98 VA_END (Marker);
99 return Return;
100 }
101
102 UINTN
103 AsciiVSPrint (
104 OUT CHAR8 *StartOfBuffer,
105 IN UINTN BufferSize,
106 IN const CHAR8 *FormatString,
107 IN VA_LIST Marker
108 )
109 /*++
110
111 Routine Description:
112
113 VSPrint function to process format and place the results in Buffer. Since a
114 VA_LIST is used this rountine allows the nesting of Vararg routines. Thus
115 this is the main print working routine
116
117 Arguments:
118
119 StartOfBuffer - Unicode buffer to print the results of the parsing of Format into.
120
121 BufferSize - Maximum number of characters to put into buffer. Zero means
122 no limit.
123
124 FormatString - Unicode format string see file header for more details.
125
126 Marker - Vararg list consumed by processing Format.
127
128 Returns:
129
130 Number of characters printed.
131
132 --*/
133 {
134 return 0;
135 }
136
137 UINTN
138 AsciiSPrint (
139 OUT CHAR8 *StartOfBuffer,
140 IN UINTN BufferSize,
141 IN const CHAR8 *FormatString,
142 ...
143 )
144
145 {
146 UINTN Return;
147 VA_LIST Marker;
148
149 VA_START (Marker, FormatString);
150 Return = AsciiVSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
151 VA_END (Marker);
152 return Return;
153 }