本文整理汇总了C++中Sys_Print函数的典型用法代码示例。如果您正苦于以下问题:C++ Sys_Print函数的具体用法?C++ Sys_Print怎么用?C++ Sys_Print使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Sys_Print函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Com_Error
void Com_Error(bool exit, const char* format, ...)
{
static char buffer[32768] = { 0 };
va_list va;
va_start(va, format);
//vprintf(format, va);
_vsnprintf(buffer, sizeof(buffer), format, va);
va_end(va);
if (console){
Sys_Print("^1ERROR: ");
Sys_Print(buffer);
Sys_Print("^7\n");
}
else {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
printf("ERROR: %s\n", buffer);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
}
if (exit)
{
if (IsDebuggerPresent())
{
DebugBreak();
}
TerminateProcess(GetCurrentProcess(), -1);
}
}
示例2: MsgDev
/*
================
MsgDev
formatted developer message
================
*/
void MsgDev( int level, const char *pMsg, ... )
{
va_list argptr;
char text[8192];
if( host.developer < level ) return;
va_start( argptr, pMsg );
Q_vsnprintf( text, sizeof( text ), pMsg, argptr );
va_end( argptr );
switch( level )
{
case D_WARN:
Sys_Print( va( "^3Warning:^7 %s", text ));
break;
case D_ERROR:
Sys_Print( va( "^1Error:^7 %s", text ));
break;
case D_INFO:
case D_NOTE:
case D_AICONSOLE:
Sys_Print( text );
break;
}
}
示例3: Cmd_Echo_f
/*
===============
Cmd_Echo_f
Just prints the rest of the line to the console
===============
*/
void Cmd_Echo_f( void )
{
int i;
for( i = 1; i < Cmd_Argc(); i++ )
Sys_Print( Cmd_Argv( i ));
Sys_Print( "\n" );
}
示例4: Sys_ErrorDialog
/*
==============
Sys_ErrorDialog
Display an error message
==============
*/
void Sys_ErrorDialog( const char *error )
{
char buffer[ 1024 ];
unsigned int size;
fileHandle_t f;
const char *fileName = "crashlog.txt";
// Shut down now so that the curses console doesn't clear the screen when it's really shut down
CON_Shutdown( );
Sys_Print( va( "%s\n", error ) );
// Write console log to file and to stderr
f = FS_SV_FOpenFileWrite( fileName );
if( !f )
{
Com_Printf( "ERROR: couldn't open %s\n", fileName );
return;
}
while( ( size = CON_LogRead( buffer, sizeof( buffer ) ) ) > 0 )
{
FS_Write( buffer, size, f );
fputs( buffer, stderr );
}
FS_FCloseFile( f );
}
示例5: Sys_Error
/*
=============
Sys_Error
A raw string should NEVER be passed as fmt, because of "%f" type crashers.
=============
*/
__cdecl void QDECL Sys_Error( const char *fmt, ... ) {
FILE * fdout;
char* fileout = "sys_error.txt";
va_list argptr;
char msg[MAXPRINTMSG];
char buffer[MAXPRINTMSG];
va_start (argptr,fmt);
Q_vsnprintf (msg, sizeof(msg), fmt, argptr);
va_end (argptr);
Com_sprintf(buffer, sizeof(buffer), "\nSys_Error: %s\n", msg);
//Print the error to our console
Sys_Print( buffer );
//Try to write the error into a file
fdout=fopen(fileout, "w");
if(fdout){
fwrite(buffer, strlen(buffer), 1 ,fdout);
fclose(fdout);
}
Sys_WaitForErrorConfirmation( msg );
Sys_Exit( 1 ); // bk010104 - use single exit point.
}
示例6: Win_PrintMatches
static void Win_PrintMatches(const char *s)
{
if(!Q_stricmpn(s, win_currentMatch, win_acLength))
{
Sys_Print(va(" ^9%s^0\n", s));
}
}
示例7: Sys_Break
/*
================
Sys_Break
same as Error
================
*/
void Sys_Break( const char *error, ... )
{
va_list argptr;
char text[MAX_SYSPATH];
if( host.state == HOST_ERR_FATAL )
return; // don't multiple executes
error_on_exit = true;
host.state = HOST_ERR_FATAL;
va_start( argptr, error );
Q_vsprintf( text, error, argptr );
va_end( argptr );
if( host.type == HOST_NORMAL )
{
if( host.hWnd ) ShowWindow( host.hWnd, SW_HIDE );
VID_RestoreGamma();
}
if( host.type != HOST_NORMAL || host.developer > 0 )
{
Con_ShowConsole( true );
Con_DisableInput(); // disable input line for dedicated server
Sys_Print( text );
Sys_WaitForQuit();
}
else
{
Con_ShowConsole( false );
MSGBOX( text );
}
Sys_Quit();
}
示例8: Win_PrintCvarMatches
// ydnar: to display cvar values
static void Win_PrintCvarMatches(const char *s)
{
if(!Q_stricmpn(s, win_currentMatch, win_acLength))
{
Sys_Print(va(" ^9%s = ^5%s^0\n", s, Cvar_VariableString(s)));
}
}
示例9: InputLineWndProc
LONG WINAPI InputLineWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
char inputBuffer[1024];
switch ( uMsg )
{
case WM_KILLFOCUS:
if ( ( HWND ) wParam == s_wcd.hWnd ||
( HWND ) wParam == s_wcd.hwndErrorBox )
{
SetFocus( hWnd );
return 0;
}
break;
case WM_CHAR:
if ( wParam == 13 )
{
GetWindowText( s_wcd.hwndInputLine, inputBuffer, sizeof( inputBuffer ) );
strncat( s_wcd.consoleText, inputBuffer, sizeof( s_wcd.consoleText ) - strlen( s_wcd.consoleText ) - 5 );
strcat( s_wcd.consoleText, "\n" );
SetWindowText( s_wcd.hwndInputLine, "" );
Sys_Print( va( "]%s\n", inputBuffer ) );
return 0;
}
}
return CallWindowProc( s_wcd.SysInputLineWndProc, hWnd, uMsg, wParam, lParam );
}
示例10: Sys_ErrorDialog
/**
* @brief Displays an error message and writes the error into crashlog.txt
* @param[in] error Error String
*/
void Sys_ErrorDialog(const char *error)
{
char buffer[1024];
unsigned int size;
int f = -1;
const char *homepath = Cvar_VariableString("fs_homepath");
const char *gamedir = Cvar_VariableString("fs_gamedir");
const char *fileName = "crashlog.txt";
char *dirpath = FS_BuildOSPath(homepath, gamedir, "");
char *ospath = FS_BuildOSPath(homepath, gamedir, fileName);
Sys_Print(va("%s\n", error));
#ifndef DEDICATED
// We may have grabbed input devices. Need to release.
if (SDL_WasInit(SDL_INIT_VIDEO))
{
SDL_WM_GrabInput(SDL_GRAB_OFF);
}
Sys_Dialog(DT_ERROR, va("%s\nSee \"%s\" for details.\n", error, ospath), "Error");
#endif
// Make sure the write path for the crashlog exists...
// check homepath
if (!Sys_Mkdir(homepath))
{
Com_Printf("ERROR: couldn't create path '%s' to write file '%s'.\n", homepath, ospath);
return;
}
// check gamedir (inside homepath)
if (!Sys_Mkdir(dirpath))
{
Com_Printf("ERROR: couldn't create path '%s' to write file '%s'.\n", dirpath, ospath);
return;
}
// We might be crashing because we maxed out the Quake MAX_FILE_HANDLES,
// which will come through here, so we don't want to recurse forever by
// calling FS_FOpenFileWrite()...use the Unix system APIs instead.
f = open(ospath, O_CREAT | O_TRUNC | O_WRONLY, 0640);
if (f == -1)
{
Com_Printf("ERROR: couldn't open '%s'\n", fileName);
return;
}
// We're crashing, so we don't care much if write() or close() fails.
while ((size = CON_LogRead(buffer, sizeof(buffer))) > 0)
{
if (write(f, buffer, size) != size)
{
Com_Printf("ERROR: couldn't fully write to '%s'\n", fileName);
break;
}
}
close(f);
}
示例11: Sys_Error
/*
=================
Sys_Error
=================
*/
void Sys_Error( const char *error, ... ) {
va_list argptr;
char string[4096];
#if defined (_WIN32) && !defined (_DEBUG)
MSG msg;
#endif
va_start (argptr,error);
idStr::vsnPrintf (string, sizeof(string), error, argptr);
va_end (argptr);
#if defined (_WIN32) && !defined (_DEBUG)
Conbuf_AppendText( string );
Conbuf_AppendText( "\n" );
#else
// Print text in the console window/box
Sys_Print( string );
Sys_Print( "\n" );
#endif
#if defined (_WIN32) && !defined (_DEBUG)
Sys_SetErrorText( string );
Sys_ShowConsole( 1, qtrue );
timeEndPeriod( 1 );
IN_Shutdown();
// wait for the user to quit
while ( 1 ) {
if ( !GetMessage( &msg, NULL, 0, 0 ) ) {
Com_Quit_f();
}
TranslateMessage( &msg );
DispatchMessage( &msg );
}
Sys_DestroyConsole();
#endif
CL_Shutdown( );
Sys_ErrorDialog( string );
Sys_Exit( 1 );
}
示例12: Msg
/*
================
Msg
formatted message
================
*/
void Msg( const char *pMsg, ... )
{
va_list argptr;
char text[8192];
va_start( argptr, pMsg );
Q_vsnprintf( text, sizeof( text ), pMsg, argptr );
va_end( argptr );
Sys_Print( text );
}
示例13: Com_PrintMessage
__cdecl void Com_PrintMessage( int dumbIWvar, char *msg, msgtype_t type) {
//secures calls to Com_PrintMessage from recursion while redirect printing
static qboolean lock = qfalse;
if(dumbIWvar == 6) return;
int msglen = strlen(msg);
if(type != MSG_NORDPRINT && !lock)
{
Sys_EnterCriticalSection(CRIT_REDIRECTPRINT);
if ( !lock) {
lock = qtrue;
Com_PrintRedirect(msg, msglen);
lock = qfalse;
if ( rd_buffer ) {
if(!rd_flush){
Sys_LeaveCriticalSection(CRIT_REDIRECTPRINT);
return;
}
if ((msglen + strlen(rd_buffer)) > (rd_buffersize - 1)) {
lock = qtrue;
rd_flush(rd_buffer, qfalse);
lock = qfalse;
*rd_buffer = 0;
}
Q_strcat(rd_buffer, rd_buffersize, msg);
// TTimo nooo .. that would defeat the purpose
//rd_flush(rd_buffer);
//*rd_buffer = 0;
Sys_LeaveCriticalSection(CRIT_REDIRECTPRINT);
return;
}
}
Sys_LeaveCriticalSection(CRIT_REDIRECTPRINT);
}
// echo to dedicated console and early console
Sys_Print( msg );
// logfile
Com_PrintLogfile( msg );
}
示例14: Cmd_Echo_f
/*
===============
Cmd_Echo_f
Just prints the rest of the line to the console
===============
*/
void Cmd_Echo_f( void )
{
int i;
static char buf[1024];
for( i = 1; i < Cmd_Argc(); i++ )
{
Q_strncat( buf, Cmd_Argv( i ), 1024 );
Q_strncat( buf, " ", 1024 );
}
Q_strncat( buf, "\n", 1024 );
Sys_Print( buf );
}
示例15: Com_Debug_
void Com_Debug_(const char* format, ...)
{
static char buffer[32768] = { 0 };
va_list va;
va_start(va, format);
//vprintf(format, va);
_vsnprintf(buffer, sizeof(buffer), format, va);
va_end(va);
if (console){
Sys_Print("^3");
Sys_Print(buffer);
Sys_Print("^7");
}
else {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
printf(buffer);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
}
}