TianoCore EDK2 master
Loading...
Searching...
No Matches
UnitTestResultReportLibConOut.c
Go to the documentation of this file.
1
8#include <Uefi.h>
9#include <Library/BaseLib.h>
10#include <Library/PrintLib.h>
12#include <Library/DebugLib.h>
13
14VOID
15EFIAPI
16ReportPrint (
17 IN CONST CHAR8 *Format,
18 ...
19 )
20{
21 VA_LIST Marker;
22 CHAR16 String[256];
23 UINTN Length;
24
25 VA_START (Marker, Format);
26 Length = UnicodeVSPrintAsciiFormat (String, sizeof (String), Format, Marker);
27 if (Length == 0) {
28 DEBUG ((DEBUG_ERROR, "%a formatted string is too long\n", __func__));
29 } else {
30 gST->ConOut->OutputString (gST->ConOut, String);
31 }
32
33 VA_END (Marker);
34}
35
36VOID
37ReportOutput (
38 IN CONST CHAR8 *Output
39 )
40{
41 CHAR8 AsciiString[128];
42 UINTN Length;
43 UINTN Index;
44
45 Length = AsciiStrLen (Output);
46 for (Index = 0; Index < Length; Index += (sizeof (AsciiString) - 1)) {
47 AsciiStrnCpyS (AsciiString, sizeof (AsciiString), &Output[Index], sizeof (AsciiString) - 1);
48 ReportPrint ("%a", AsciiString);
49 }
50}
UINT64 UINTN
RETURN_STATUS EFIAPI AsciiStrnCpyS(OUT CHAR8 *Destination, IN UINTN DestMax, IN CONST CHAR8 *Source, IN UINTN Length)
Definition: SafeString.c:1875
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
Definition: String.c:641
UINTN EFIAPI UnicodeVSPrintAsciiFormat(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString, IN VA_LIST Marker)
Definition: PrintLib.c:465
#define CONST
Definition: Base.h:259
#define VA_START(Marker, Parameter)
Definition: Base.h:661
CHAR8 * VA_LIST
Definition: Base.h:643
#define IN
Definition: Base.h:279
#define VA_END(Marker)
Definition: Base.h:691
#define DEBUG(Expression)
Definition: DebugLib.h:434
EFI_SYSTEM_TABLE * gST
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut
Definition: UefiSpec.h:2064