2 Basic Ascii AvSPrintf() function named VSPrint(). VSPrint() enables very
3 simple implemenation of SPrint() and Print() to support debug.
5 You can not Print more than EFI_DRIVER_LIB_MAX_PRINT_BUFFER characters at a
6 time. This makes the implementation very simple.
8 VSPrint, Print, SPrint format specification has the follwoing form
13 'S','s' - argument is an Unicode string
14 'c' - argument is an ascii character
17 Copyright (c) 2006, Intel Corporation
18 All rights reserved. This program and the accompanying materials
19 are licensed and made available under the terms and conditions of the BSD License
20 which accompanies this distribution. The full text of the license may be found at
21 http://opensource.org/licenses/bsd-license.php
23 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
24 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
35 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*Out
,
40 // Display string worker for: Print, PrintAt, IPrint, IPrintAt
49 // For now, allocate an arbitrarily long buffer
51 Buffer
= AllocateZeroPool (0x10000);
52 BackupBuffer
= AllocateZeroPool (0x10000);
54 ASSERT (BackupBuffer
);
56 if (Column
!= (UINTN
) -1) {
57 Out
->SetCursorPosition (Out
, Column
, Row
);
60 UnicodeVSPrint (Buffer
, 0x10000, fmt
, args
);
62 Out
->Mode
->Attribute
= Out
->Mode
->Attribute
& 0x7f;
64 Out
->SetAttribute (Out
, Out
->Mode
->Attribute
);
70 for (; (Buffer
[Index
] != NARROW_CHAR
) && (Buffer
[Index
] != WIDE_CHAR
) && (Buffer
[Index
] != 0); Index
++) {
71 BackupBuffer
[Index
] = Buffer
[Index
];
74 if (Buffer
[Index
] == 0) {
78 // Null-terminate the temporary string
80 BackupBuffer
[Index
] = 0;
83 // Print this out, we are about to switch widths
85 Out
->OutputString (Out
, &BackupBuffer
[PreviousIndex
]);
88 // Preserve the current index + 1, since this is where we will start printing from next
90 PreviousIndex
= Index
+ 1;
93 // We are at a narrow or wide character directive. Set attributes and strip it and print it
95 if (Buffer
[Index
] == NARROW_CHAR
) {
97 // Preserve bits 0 - 6 and zero out the rest
99 Out
->Mode
->Attribute
= Out
->Mode
->Attribute
& 0x7f;
100 Out
->SetAttribute (Out
, Out
->Mode
->Attribute
);
103 // Must be wide, set bit 7 ON
105 Out
->Mode
->Attribute
= Out
->Mode
->Attribute
| EFI_WIDE_ATTRIBUTE
;
106 Out
->SetAttribute (Out
, Out
->Mode
->Attribute
);
111 } while (Buffer
[Index
] != 0);
114 // We hit the end of the string - print it
116 Out
->OutputString (Out
, &BackupBuffer
[PreviousIndex
]);
119 FreePool (BackupBuffer
);
132 Prints a formatted unicode string to the default console
140 Length of string printed to the console
146 VA_START (args
, fmt
);
147 return _IPrint ((UINTN
) -1, (UINTN
) -1, gST
->ConOut
, fmt
, args
);
158 Prints a unicode string to the default console,
163 String - String pointer.
167 Length of string printed to the console
171 return Print ((CHAR16
*) L
"%s", String
);
182 Prints a chracter to the default console,
187 Character - Character to print.
191 Length of string printed to the console.
195 return Print ((CHAR16
*) L
"%c", Character
);
209 Prints a formatted unicode string to the default console, at
210 the supplied cursor position
214 Column, Row - The cursor position to print the string at
220 Length of string printed to the console
226 VA_START (args
, fmt
);
227 return _IPrint (Column
, Row
, gST
->ConOut
, fmt
, args
);
240 Prints a unicode string to the default console, at
241 the supplied cursor position, using L"%s" format.
245 Column, Row - The cursor position to print the string at
247 String - String pointer.
251 Length of string printed to the console
255 return PrintAt (Column
, Row
, (CHAR16
*) L
"%s", String
);
268 Prints a chracter to the default console, at
269 the supplied cursor position, using L"%c" format.
273 Column, Row - The cursor position to print the string at
275 Character - Character to print.
279 Length of string printed to the console.
283 return PrintAt (Column
, Row
, (CHAR16
*) L
"%c", Character
);