本文整理汇总了C++中VA_END函数的典型用法代码示例。如果您正苦于以下问题:C++ VA_END函数的具体用法?C++ VA_END怎么用?C++ VA_END使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VA_END函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: snprintf
static int
snprintf(char *str, size_t n, char const *fmt, ...)
{
va_list ap;
int rval;
#ifdef VSPRINTF_CHARSTAR
char *rp;
VA_START(ap, fmt);
rp = vsprintf(str, fmt, ap);
VA_END(ap);
rval = strlen(rp);
#else
VA_START(ap, fmt);
rval = vsprintf(str, fmt, ap);
VA_END(ap);
#endif
if (rval > n) {
fprintf(stderr, "snprintf buffer overrun %d > %d\n", rval, (int)n);
abort();
}
return rval;
}
示例2: UnisatllProtocolInterface
/**
Uninstalls a list of protocol interface in the boot services environment.
This function calls UnisatllProtocolInterface() in a loop. This is
basically a lib function to save space.
@param Handle The handle to uninstall the protocol
@param ... EFI_GUID followed by protocol instance. A NULL
terminates the list. The pairs are the
arguments to UninstallProtocolInterface(). All
the protocols are added to Handle.
@return Status code
**/
EFI_STATUS
EFIAPI
CoreUninstallMultipleProtocolInterfaces (
IN EFI_HANDLE Handle,
...
)
{
EFI_STATUS Status;
VA_LIST Args;
EFI_GUID *Protocol;
VOID *Interface;
UINTN Index;
VA_START (Args, Handle);
for (Index = 0, Status = EFI_SUCCESS; !EFI_ERROR (Status); Index++) {
//
// If protocol is NULL, then it's the end of the list
//
Protocol = VA_ARG (Args, EFI_GUID *);
if (Protocol == NULL) {
break;
}
Interface = VA_ARG (Args, VOID *);
//
// Uninstall it
//
Status = CoreUninstallProtocolInterface (Handle, Protocol, Interface);
}
VA_END (Args);
//
// If there was an error, add all the interfaces that were
// uninstalled without any errors
//
if (EFI_ERROR (Status)) {
//
// Reset the va_arg back to the first argument.
//
VA_START (Args, Handle);
for (; Index > 1; Index--) {
Protocol = VA_ARG(Args, EFI_GUID *);
Interface = VA_ARG(Args, VOID *);
CoreInstallProtocolInterface (&Handle, Protocol, EFI_NATIVE_INTERFACE, Interface);
}
VA_END (Args);
}
return Status;
}
示例3: GetDebugPrintErrorLevel
/**
Prints a debug message to the debug output device if the specified error level is enabled.
If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
GetDebugPrintErrorLevel (), then print the message specified by Format and the
associated variable argument list to the debug output device.
If Format is NULL, then ASSERT().
@param ErrorLevel The error level of the debug message.
@param Format Format string for the debug message to print.
@param ... A variable argument list whose contents are accessed
based on the format string specified by Format.
**/
VOID
EFIAPI
DebugPrint (
IN UINTN ErrorLevel,
IN CONST CHAR8 *Format,
...
)
{
CHAR8 Buffer[MAX_DEBUG_MESSAGE_LENGTH];
VA_LIST Marker;
//
// If Format is NULL, then ASSERT().
//
ASSERT (Format != NULL);
//
// Check driver debug mask value and global mask
//
if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {
return;
}
//
// Convert the DEBUG() message to an ASCII String
//
VA_START (Marker, Format);
AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);
VA_END (Marker);
//
// Send the print string to EFI_DEBUGPORT_PROTOCOL.Write.
//
UefiDebugLibDebugPortProtocolWrite (Buffer, AsciiStrLen (Buffer));
}
示例4: PrintString
VOID
EFIAPI
PrintString (
IN CONST CHAR8 *FormatString,
...
)
{
#if (DEBUG_PRINT_LEVEL & 0x7FFFFFFF)
UINTN Index;
CHAR8 PrintBuffer[1000];
VA_LIST Marker;
VA_START (Marker, FormatString);
AsciiVSPrint (PrintBuffer, sizeof (PrintBuffer), FormatString, Marker);
VA_END (Marker);
for (Index = 0; PrintBuffer[Index] != 0; Index++) {
if (PrintBuffer[Index] == '\n') {
mCursor = (UINT8 *) (UINTN) (0xb8000 + (((((UINTN)mCursor - 0xb8000) + 160) / 160) * 160));
} else if (PrintBuffer[Index] != '\r') { // skip non-displayable character
*mCursor = (UINT8) PrintBuffer[Index];
mCursor += 2;
}
}
//
// All information also output to serial port.
//
SerialPortWrite ((UINT8 *) PrintBuffer, Index);
#endif
}
示例5: VA_START
void Logging::Printf(const TDesC8& aSubTag, TRefByValue<const TDesC8> aFmt, ...)
{
VA_LIST list;
VA_START(list,aFmt);
Printf(aSubTag, Logging::ELogInfo, aFmt, list);
VA_END(list);
}
示例6: PrintString
VOID
EFIAPI
PrintString (
IN CONST CHAR8 *FormatString,
...
)
{
UINTN Index;
CHAR8 PrintBuffer[256];
VA_LIST Marker;
VA_START (Marker, FormatString);
AsciiVSPrint (PrintBuffer, sizeof (PrintBuffer), FormatString, Marker);
VA_END (Marker);
for (Index = 0; PrintBuffer[Index] != 0; Index++) {
if (PrintBuffer[Index] == '\n') {
mCursor = (UINT8 *) (UINTN) (0xb8000 + (((((UINTN)mCursor - 0xb8000) + 160) / 160) * 160));
} else {
*mCursor = (UINT8) PrintBuffer[Index];
mCursor += 2;
}
}
//
// All information also output to serial port.
//
SerialPortWrite ((UINT8 *) PrintBuffer, Index);
}
示例7: EfiDebugPrint
VOID
EfiDebugPrint (
IN UINTN ErrorLevel,
IN CHAR8 *Format,
...
)
/*++
Routine Description:
Worker function for DEBUG (). If Error Logging hub is loaded log ASSERT
information. If Error Logging hub is not loaded do nothing.
We use UINT64 buffers due to IPF alignment concerns.
Arguments:
ErrorLevel - If error level is set do the debug print.
Format - String to use for the print, followed by Print arguments.
... - VAR args for Format
Returns:
None
--*/
{
VA_LIST Marker;
VA_START (Marker, Format);
EfiDebugVPrint (ErrorLevel, Format, Marker);
VA_END (Marker);
}
示例8: UnicodeVSPrint
/**
Formatted Print using a Hii Token to reference the localized format string.
@param[in] Token A HII token associated with a localized Unicode string.
@param[in] ... The variable argument list.
@return The number of characters converted by UnicodeVSPrint().
**/
UINTN
EFIAPI
PrintToken (
IN UINT16 Token,
...
)
{
VA_LIST Marker;
EFI_STRING StringPtr;
UINTN Return;
UINTN BufferSize;
StringPtr = HiiGetString (gHiiHandle, Token, NULL);
ASSERT (StringPtr != NULL);
VA_START (Marker, Token);
BufferSize = (PcdGet32 (PcdUefiLibMaxPrintBufferSize) + 1) * sizeof (CHAR16);
if (mPrintTokenBuffer == NULL) {
mPrintTokenBuffer = AllocatePool (BufferSize);
ASSERT (mPrintTokenBuffer != NULL);
}
SetMem( mPrintTokenBuffer, BufferSize, 0);
Return = UnicodeVSPrint (mPrintTokenBuffer, BufferSize, StringPtr, Marker);
VA_END (Marker);
if (Return > 0 && gST->ConOut != NULL) {
gST->ConOut->OutputString (gST->ConOut, mPrintTokenBuffer);
}
FreePool (StringPtr);
return Return;
}
示例9: BdsLibOutputStrings
/**
This function prints a series of strings.
@param ConOut Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
@param ... A variable argument list containing series of
strings, the last string must be NULL.
@retval EFI_SUCCESS Success print out the string using ConOut.
@retval EFI_STATUS Return the status of the ConOut->OutputString ().
**/
EFI_STATUS
EFIAPI
BdsLibOutputStrings (
IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut,
...
)
{
VA_LIST Args;
EFI_STATUS Status;
CHAR16 *String;
Status = EFI_SUCCESS;
VA_START (Args, ConOut);
while (!EFI_ERROR (Status)) {
//
// If String is NULL, then it's the end of the list
//
String = VA_ARG (Args, CHAR16 *);
if (String == NULL) {
break;
}
Status = ConOut->OutputString (ConOut, String);
if (EFI_ERROR (Status)) {
break;
}
}
VA_END(Args);
return Status;
}
示例10: Aprint
UINTN
Aprint (
IN CONST CHAR8 *Format,
...
)
/*++
Routine Description:
Print function for a maximum of EFI_DRIVER_LIB_MAX_PRINT_BUFFER ascii
characters.
Arguments:
Format - Ascii format string see file header for more details.
... - Vararg list consumed by processing Format.
Returns:
Number of characters printed.
--*/
{
UINTN Return;
VA_LIST Marker;
UINTN Index;
UINTN MaxIndex;
CHAR16 Buffer[EFI_DRIVER_LIB_MAX_PRINT_BUFFER];
CHAR16 UnicodeFormat[EFI_DRIVER_LIB_MAX_PRINT_BUFFER];
MaxIndex = EfiAsciiStrLen ((CHAR8 *) Format);
if (MaxIndex >= EFI_DRIVER_LIB_MAX_PRINT_BUFFER) {
//
// Format string was too long for use to process.
//
return 0;
}
for (Index = 0; Index < EFI_DRIVER_LIB_MAX_PRINT_BUFFER; Index++) {
UnicodeFormat[Index] = (CHAR16) Format[Index];
}
VA_START (Marker, Format);
Return = VSPrint (Buffer, sizeof (Buffer), UnicodeFormat, Marker);
VA_END (Marker);
//
// Need to convert to Unicode to do an OutputString
//
if (gST->ConOut != NULL) {
//
// To be extra safe make sure ConOut has been initialized
//
gST->ConOut->OutputString (gST->ConOut, Buffer);
}
return Return;
}
示例11: ASSERT
/**
Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack
new stack specified by NewStack and passing in the parameters specified
by Context1 and Context2. Context1 and Context2 are optional and may
be NULL. The function EntryPoint must never return. This function
supports a variable number of arguments following the NewStack parameter.
These additional arguments are ignored on IA-32, x64, and EBC.
IPF CPUs expect one additional parameter of type VOID * that specifies
the new backing store pointer.
If EntryPoint is NULL, then ASSERT().
If NewStack is NULL, then ASSERT().
@param EntryPoint A pointer to function to call with the new stack.
@param Context1 A pointer to the context to pass into the EntryPoint
function.
@param Context2 A pointer to the context to pass into the EntryPoint
function.
@param NewStack A pointer to the new stack to use for the EntryPoint
function.
**/
VOID
EFIAPI
SwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack,
...
)
{
VA_LIST Marker;
ASSERT (EntryPoint != NULL);
ASSERT (NewStack != NULL);
VA_START (Marker, NewStack);
InternalSwitchStack (EntryPoint, Context1, Context2, NewStack, Marker);
VA_END (Marker);
//
// InternalSwitchStack () will never return
//
ASSERT (FALSE);
}
示例12: Debug
GLDEF_C void Debug( TRefByValue<const TDesC> aText, ... )
{
#ifdef WINS
VA_LIST args;
VA_START( args, aText );
TBuf<KLogLineLength> buf;
buf.FormatList( aText, args );
RFileLogger logger;
TInt ret=logger.Connect();
if (ret==KErrNone)
{
logger.SetDateAndTime( EFalse,EFalse );
logger.CreateLog( KLogFolder, KLogFileName, EFileLoggingModeAppend );
TBuf<KLogTimeFormatLength> timeStamp;
TTime now;
now.HomeTime();
TDateTime dateTime;
dateTime = now.DateTime();
timeStamp.Format( KLogTimeFormat,
dateTime.Hour(), dateTime.Minute(),
dateTime.Second(), dateTime.MicroSecond() );
buf.Insert( 0, timeStamp );
logger.Write(buf);
}
logger.Close();
VA_END( args );
#else
RDebug::Print(aText);
#endif
}
示例13: EfiBootManagerRegisterContinueKeyOption
EFI_STATUS
EFIAPI
EfiBootManagerRegisterContinueKeyOption (
IN UINT32 Modifier,
...
)
{
EFI_STATUS Status;
EFI_BOOT_MANAGER_KEY_OPTION KeyOption;
VA_LIST Args;
if (mContinueKeyOption != NULL) {
return EFI_ALREADY_STARTED;
}
ZeroMem (&KeyOption, sizeof (EFI_BOOT_MANAGER_KEY_OPTION));
VA_START (Args, Modifier);
Status = InitializeKeyFields (Modifier, Args, &KeyOption);
VA_END (Args);
if (!EFI_ERROR (Status)) {
mContinueKeyOption = AllocateCopyPool (sizeof (EFI_BOOT_MANAGER_KEY_OPTION), &KeyOption);
ASSERT (mContinueKeyOption != NULL);
if (mHotkeyServiceStarted) {
ProcessKeyOption (mContinueKeyOption);
}
}
return Status;
}
示例14: PrintToken
UINTN
EFIAPI
PrintToken (
IN UINT16 Token,
IN EFI_HII_HANDLE Handle,
...
)
{
VA_LIST Marker;
UINTN Return;
CHAR16 *Format;
VA_START (Marker, Handle);
Format = HiiGetString (Handle, Token, NULL);
ASSERT (Format != NULL);
Return = InternalPrintToken (Format, gST->ConOut, Marker);
FreePool (Format);
VA_END (Marker);
return Return;
}
示例15: USPrint
UINTN
USPrint (
OUT CHAR16 *Buffer,
IN UINTN BufferSize,
IN CONST CHAR16 *Format,
...
)
/*++
Routine Description:
Process format and place the results in Buffer for wide chars.
Arguments:
Buffer - Wide char buffer to print the results of the parsing of Format into.
BufferSize - Maximum number of characters to put into buffer.
Format - Format string
... - Vararg list consumed by processing Format.
Returns:
Number of characters printed.
--*/
{
UINTN Return;
VA_LIST Marker;
VA_START (Marker, Format);
Return = UnicodeVSPrint (Buffer, BufferSize, Format, Marker);
VA_END (Marker);
return Return;
}