本文整理汇总了C++中VA_START函数的典型用法代码示例。如果您正苦于以下问题:C++ VA_START函数的具体用法?C++ VA_START怎么用?C++ VA_START使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VA_START函数的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: VA_START
void Logging::Printf(const TDesC8& aSubTag, TLogEntryType aType, TRefByValue<const TDesC8> aFmt, ...)
{
VA_LIST list;
VA_START(list,aFmt);
Printf(aSubTag, aType, aFmt, list);
VA_END(list);
}
示例4: VA_START
// ---------------------------------------------------------------------------
// Writes to log.
// ---------------------------------------------------------------------------
//
void CKmdDebugLogger::LogWriteF( TRefByValue<const TDesC8> aFmt, ... )
{
VA_LIST list;
VA_START( list,aFmt );
iFileLogger.WriteFormat( aFmt, list );
}
示例5: LogPrint
/**
prints a line to the console and copies it to the debug log if LOGGING_ENABLED
*/
void LogPrint(TRefByValue<const TDesC> aFmt,...)
{
VA_LIST list;
VA_START(list, aFmt);
TBuf<0x100> buf;
buf.FormatList(aFmt, list); //-- ignore overflows
if(console)
console->Write(buf);
#ifdef LOGGING_ENABLED
//-- print out the line via RDebug::Print
const TInt bufLen = buf.Length();
if(bufLen >0 && buf[bufLen-1] == '\n')
{
buf.Insert(bufLen-1, _L("\r"));
}
else
{
buf.Append(_L("\r\n"));
}
RDebug::RawPrint(buf);
#endif
}
示例6: send_msg
static int send_msg(process *pp, int act, const char *fmt, ...)
{int nl;
char msg[BFLRG];
char *p;
dbgrsp *gr;
atdbgdes *st;
VA_START(fmt);
if (fmt == NULL)
p = NULL;
else
{VSNPRINTF(msg, BFLRG, fmt);
p = msg;};
VA_END;
gr = (dbgrsp *) pp->a;
st = gr->st;
gr->action = act;
/* log the message sent */
if ((st->log != NULL) && (p != NULL))
fprintf(st->log, "SND: %s\n", p);
nl = job_response(pp, 30000, p);
return(nl);}
示例7: 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;
}
示例8: VA_START
void CDTSYLogger::WriteFormat(TRefByValue<const TDesC8> aFmt,...)
{
TBuf8<KGenericBufferSize> buf;
VA_LIST list;
VA_START(list,aFmt);
buf.FormatList(aFmt,list);
TChar tmpchar;
for(TInt i=0;i<buf.Length();i++)
{
tmpchar=buf[i];
if(!((tmpchar.IsPrint()) || (tmpchar=='\n') || (tmpchar=='\r') || (tmpchar=='\t')))
buf[i]='.';
}
#ifdef __EXE__
CDTSYLogger* context=aScriptLoggerContext;
#else
CDTSYLogger* context=(CDTSYLogger*) Dll::Tls();
#endif
if(context==NULL)
{
TRAPD(ret,context=CDTSYLogger::NewL());
if (ret==KErrNone)
{
#ifdef __EXE__
aScriptLoggerContext=context;
#else
Dll::SetTls(context);
#endif
}
else return;
}
if(context->iValid)
context->WriteRecord(buf);
}
示例9: VA_START
void CTestTransaction::Log(TRefByValue<const TDesC> aFmt, ... )
{
VA_LIST list;
VA_START(list, aFmt);
Machine()->MsgPrintfln(aFmt, list);
}
示例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: VA_START
void PredLog::Printf(TRefByValue<const TDesC> aFmt, ...)
{
VA_LIST list;
VA_START(list,aFmt);
RFileLogger::WriteFormat(KPredLogFolder(),KPredLogFile(),EFileLoggingModeAppend,aFmt,list);
}
示例14: 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;
}
示例15: UhciError
VOID
UhciError (
IN CHAR8 *Format,
...
)
/*++
Routine Description:
Debug error print interface for UHCI
Arguments:
Format - String to use for the print, followed by print arguments
Returns:
None
--*/
{
VA_LIST Marker;
VA_START (Marker, Format);
EfiDebugVPrint (EFI_D_ERROR, Format, Marker);
VA_END (Marker);
}