本文整理汇总了C++中EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL::OutputString方法的典型用法代码示例。如果您正苦于以下问题:C++ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL::OutputString方法的具体用法?C++ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL::OutputString怎么用?C++ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL::OutputString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
的用法示例。
在下文中一共展示了EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL::OutputString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
/**
Event handler registered with the Data Hub to parse EFI_DEBUG_CODE. This
handler reads the Data Hub and sends any DEBUG info to StdErr.
@param Event The event that occured, not used
@param Context DataHub Protocol Pointer
**/
VOID
EFIAPI
DataHubStdErrEventHandler (
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
EFI_DATA_HUB_PROTOCOL *DataHub;
EFI_DATA_RECORD_HEADER *Record;
DATA_HUB_STATUS_CODE_DATA_RECORD *DataRecord;
UINT64 Mtc;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Sto;
INT32 OldAttribute;
DataHub = (EFI_DATA_HUB_PROTOCOL *) Context;
//
// If StdErr is not yet initialized just return a DEBUG print in the BDS
// after consoles are connect will make sure data gets flushed properly
// when StdErr is available.
//
if (gST == NULL) {
return ;
}
if (gST->StdErr == NULL) {
return ;
}
//
// Mtc of zero means return the next record that has not been read by the
// event handler.
//
Mtc = 0;
do {
Status = DataHub->GetNextRecord (DataHub, &Mtc, &mDataHubStdErrEvent, &Record);
if (!EFI_ERROR (Status)) {
if (CompareGuid (&Record->DataRecordGuid, &gEfiDataHubStatusCodeRecordGuid)) {
DataRecord = (DATA_HUB_STATUS_CODE_DATA_RECORD *) (((CHAR8 *) Record) + Record->HeaderSize);
if (DataRecord->Data.HeaderSize > 0) {
if (CompareGuid (&DataRecord->Data.Type, &gEfiStatusCodeDataTypeDebugGuid)) {
//
// If the Data record is from a DEBUG () then send it to Standard Error
//
Sto = gST->StdErr;
OldAttribute = Sto->Mode->Attribute;
Sto->SetAttribute (Sto, EFI_TEXT_ATTR (EFI_MAGENTA, EFI_BLACK));
Sto->OutputString (Sto, (CHAR16 *) (DataRecord + 1));
Sto->SetAttribute (Sto, OldAttribute);
}
}
}
}
} while ((Mtc != 0) && !EFI_ERROR (Status));
}
示例2: ASSERT
//.........这里部分代码省略.........
ConOut->EnableCursor (ConOut, FALSE);
ConOut->SetAttribute (ConOut, Attribute);
//
// Limit NumberOfLines to height of the screen minus 3 rows for the box itself
//
NumberOfLines = MIN (NumberOfLines, Rows - 3);
//
// Limit MaxLength to width of the screen minus 2 columns for the box itself
//
MaxLength = MIN (MaxLength, Columns - 2);
//
// Compute the starting row and starting column for the popup
//
Row = (Rows - (NumberOfLines + 3)) / 2;
Column = (Columns - (MaxLength + 2)) / 2;
//
// Allocate a buffer for a single line of the popup with borders and a Null-terminator
//
Line = AllocateZeroPool ((MaxLength + 3) * sizeof (CHAR16));
ASSERT (Line != NULL);
//
// Draw top of popup box
//
SetMem16 (Line, (MaxLength + 2) * 2, BOXDRAW_HORIZONTAL);
Line[0] = BOXDRAW_DOWN_RIGHT;
Line[MaxLength + 1] = BOXDRAW_DOWN_LEFT;
Line[MaxLength + 2] = L'\0';
ConOut->SetCursorPosition (ConOut, Column, Row++);
ConOut->OutputString (ConOut, Line);
//
// Draw middle of the popup with strings
//
VA_START (Args, Key);
while ((String = VA_ARG (Args, CHAR16 *)) != NULL && NumberOfLines > 0) {
Length = StrLen (String);
SetMem16 (Line, (MaxLength + 2) * 2, L' ');
if (Length <= MaxLength) {
//
// Length <= MaxLength
//
CopyMem (Line + 1 + (MaxLength - Length) / 2, String , Length * sizeof (CHAR16));
} else {
//
// Length > MaxLength
//
CopyMem (Line + 1, String + (Length - MaxLength) / 2 , MaxLength * sizeof (CHAR16));
}
Line[0] = BOXDRAW_VERTICAL;
Line[MaxLength + 1] = BOXDRAW_VERTICAL;
Line[MaxLength + 2] = L'\0';
ConOut->SetCursorPosition (ConOut, Column, Row++);
ConOut->OutputString (ConOut, Line);
NumberOfLines--;
}
VA_END (Args);
//
// Draw bottom of popup box
//
SetMem16 (Line, (MaxLength + 2) * 2, BOXDRAW_HORIZONTAL);
示例3: WideTtyCvt
/* Write a NULL terminated WCS to the EFI console.
@param[in,out] BufferSize Number of bytes in Buffer. Set to zero if
the string couldn't be displayed.
@param[in] Buffer The WCS string to be displayed
@return The number of characters written.
*/
static
ssize_t
EFIAPI
da_ConWrite(
IN struct __filedes *filp,
IN off_t *Position,
IN size_t BufferSize,
IN const void *Buffer
)
{
EFI_STATUS Status;
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *Proto;
ConInstance *Stream;
ssize_t NumChar;
//XYoffset CursorPos;
Stream = BASE_CR(filp->f_ops, ConInstance, Abstraction);
// Quick check to see if Stream looks reasonable
if(Stream->Cookie != CON_COOKIE) { // Cookie == 'IoAb'
EFIerrno = RETURN_INVALID_PARAMETER;
return -1; // Looks like a bad This pointer
}
if(Stream->InstanceNum == STDIN_FILENO) {
// Write is not valid for stdin
EFIerrno = RETURN_UNSUPPORTED;
return -1;
}
// Everything is OK to do the write.
Proto = (EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *)Stream->Dev;
// Convert string from MBCS to WCS and translate \n to \r\n.
NumChar = WideTtyCvt(gMD->UString, (const char *)Buffer, BufferSize);
//if(NumChar > 0) {
// BufferSize = (size_t)(NumChar * sizeof(CHAR16));
//}
BufferSize = NumChar;
//if( Position != NULL) {
// CursorPos.Offset = (UINT64)*Position;
// Status = Proto->SetCursorPosition(Proto,
// (INTN)CursorPos.XYpos.Column,
// (INTN)CursorPos.XYpos.Row);
// if(RETURN_ERROR(Status)) {
// return -1;
// }
//}
// Send the Unicode buffer to the console
Status = Proto->OutputString( Proto, gMD->UString);
// Depending on status, update BufferSize and return
if(RETURN_ERROR(Status)) {
BufferSize = 0; // We don't really know how many characters made it out
}
else {
//BufferSize = NumChar;
Stream->NumWritten += NumChar;
}
EFIerrno = Status;
return BufferSize;
}