double fps1 = (cls.capturevideo.frame - cls.capturevideo.lastfpsframe) / (t - cls.capturevideo.lastfpstime + 0.0000001);
double fps = (cls.capturevideo.frame ) / (t - cls.capturevideo.starttime + 0.0000001);
dpsnprintf(buf, sizeof(buf), "capturevideo: (%.1fs) last second %.3ffps, total %.3ffps\n", cls.capturevideo.frame / cls.capturevideo.framerate, fps1, fps);
- Sys_PrintToTerminal(buf);
+ Sys_Print(buf);
cls.capturevideo.lastfpstime = t;
cls.capturevideo.lastfpsframe = cls.capturevideo.frame;
}
*out++ = 'm';
}
*out++ = 0;
- Sys_PrintToTerminal(printline);
+ Sys_Print(printline);
}
else if(sys_colortranslation.integer == 2) // Quake
{
- Sys_PrintToTerminal(line);
+ Sys_Print(line);
}
else // strip
{
}
}
*out++ = 0;
- Sys_PrintToTerminal(printline);
+ Sys_Print(printline);
}
}
// empty the line buffer
return DrawQ_TextWidth(w, *length, ti->fontsize, ti->fontsize, false, ti->font);
else
{
- Sys_PrintfToTerminal("Con_WordWidthFunc: can't get here (maxWidth should never be %f)\n", maxWidth);
+ Sys_Printf("Con_WordWidthFunc: can't get here (maxWidth should never be %f)\n", maxWidth);
// Note: this is NOT a Con_Printf, as it could print recursively
return 0;
}
void Sys_Error (const char *error, ...) DP_FUNC_PRINTF(1) DP_FUNC_NORETURN;
/// (may) output text to terminal which launched program
-void Sys_PrintToTerminal(const char *text);
-void Sys_PrintfToTerminal(const char *fmt, ...);
+void Sys_Print(const char *text);
+void Sys_Printf(const char *fmt, ...);
/// INFO: This is only called by Host_Shutdown so we dont need testing for recursion
void Sys_Shutdown (void);
exit (1);
}
-void Sys_PrintToTerminal(const char *text)
+void Sys_Print(const char *text)
{
#ifdef __ANDROID__
if (developer.integer > 0)
if(sys_debugsleep.integer)
{
t = Sys_DirtyTime() - t;
- Sys_PrintfToTerminal("%d %d # debugsleep\n", microseconds, (unsigned int)(t * 1000000));
+ Sys_Printf("%d %d # debugsleep\n", microseconds, (unsigned int)(t * 1000000));
}
}
-void Sys_PrintfToTerminal(const char *fmt, ...)
+void Sys_Printf(const char *fmt, ...)
{
va_list argptr;
char msg[MAX_INPUTLINE];
dpvsnprintf(msg,sizeof(msg),fmt,argptr);
va_end(argptr);
- Sys_PrintToTerminal(msg);
+ Sys_Print(msg);
}
#ifndef WIN32
exit (1);
}
-void Sys_PrintToTerminal(const char *text)
+void Sys_Print(const char *text)
{
if(sys.outfd < 0)
return;
#endif
}
-void Sys_PrintToTerminal(const char *text)
+void Sys_Print(const char *text)
{
DWORD dummy;
extern HANDLE houtput;
#include "qtypes.h"
-// enable Sys_PrintfToTerminal calls on nearly every threading call
+// enable Sys_Printf calls on nearly every threading call
//#define THREADDEBUG
//#define THREADDISABLE
// use recursive mutex (non-posix) extensions in thread_pthread
#endif
pthread_mutex_t *mutexp = (pthread_mutex_t *) Z_Malloc(sizeof(pthread_mutex_t));
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p mutex create %s:%i\n" , mutexp, filename, fileline);
+ Sys_Printf("%p mutex create %s:%i\n" , mutexp, filename, fileline);
#endif
#ifdef THREADRECURSIVE
pthread_mutexattr_init(&attr);
{
pthread_mutex_t *mutexp = (pthread_mutex_t *) mutex;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p mutex destroy %s:%i\n", mutex, filename, fileline);
+ Sys_Printf("%p mutex destroy %s:%i\n", mutex, filename, fileline);
#endif
pthread_mutex_destroy(mutexp);
Z_Free(mutexp);
{
pthread_mutex_t *mutexp = (pthread_mutex_t *) mutex;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p mutex lock %s:%i\n" , mutex, filename, fileline);
+ Sys_Printf("%p mutex lock %s:%i\n" , mutex, filename, fileline);
#endif
return pthread_mutex_lock(mutexp);
}
{
pthread_mutex_t *mutexp = (pthread_mutex_t *) mutex;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p mutex unlock %s:%i\n" , mutex, filename, fileline);
+ Sys_Printf("%p mutex unlock %s:%i\n" , mutex, filename, fileline);
#endif
return pthread_mutex_unlock(mutexp);
}
pthread_cond_t *condp = (pthread_cond_t *) Z_Malloc(sizeof(pthread_cond_t));
pthread_cond_init(condp, NULL);
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond create %s:%i\n" , condp, filename, fileline);
+ Sys_Printf("%p cond create %s:%i\n" , condp, filename, fileline);
#endif
return condp;
}
{
pthread_cond_t *condp = (pthread_cond_t *) cond;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond destroy %s:%i\n" , cond, filename, fileline);
+ Sys_Printf("%p cond destroy %s:%i\n" , cond, filename, fileline);
#endif
pthread_cond_destroy(condp);
Z_Free(condp);
{
pthread_cond_t *condp = (pthread_cond_t *) cond;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond signal %s:%i\n" , cond, filename, fileline);
+ Sys_Printf("%p cond signal %s:%i\n" , cond, filename, fileline);
#endif
return pthread_cond_signal(condp);
}
{
pthread_cond_t *condp = (pthread_cond_t *) cond;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond broadcast %s:%i\n" , cond, filename, fileline);
+ Sys_Printf("%p cond broadcast %s:%i\n" , cond, filename, fileline);
#endif
return pthread_cond_broadcast(condp);
}
pthread_cond_t *condp = (pthread_cond_t *) cond;
pthread_mutex_t *mutexp = (pthread_mutex_t *) mutex;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond wait %s:%i\n" , cond, filename, fileline);
+ Sys_Printf("%p cond wait %s:%i\n" , cond, filename, fileline);
#endif
return pthread_cond_wait(condp, mutexp);
}
{
pthread_t *threadp = (pthread_t *) Z_Malloc(sizeof(pthread_t));
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p thread create %s:%i\n" , threadp, filename, fileline);
+ Sys_Printf("%p thread create %s:%i\n" , threadp, filename, fileline);
#endif
int r = pthread_create(threadp, NULL, (void * (*) (void *)) fn, data);
if(r)
pthread_t *threadp = (pthread_t *) thread;
void *status = (void *) (intptr_t) retval;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p thread wait %s:%i\n" , thread, filename, fileline);
+ Sys_Printf("%p thread wait %s:%i\n" , thread, filename, fileline);
#endif
pthread_join(*threadp, &status);
Z_Free(threadp);
{
pthread_barrier_t *b = (pthread_barrier_t *) Z_Malloc(sizeof(pthread_barrier_t));
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p barrier create(%d) %s:%i\n", b, count, filename, fileline);
+ Sys_Printf("%p barrier create(%d) %s:%i\n", b, count, filename, fileline);
#endif
pthread_barrier_init(b, NULL, count);
return (void *) b;
{
pthread_barrier_t *b = (pthread_barrier_t *) barrier;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p barrier destroy %s:%i\n", b, filename, fileline);
+ Sys_Printf("%p barrier destroy %s:%i\n", b, filename, fileline);
#endif
pthread_barrier_destroy(b);
}
{
pthread_barrier_t *b = (pthread_barrier_t *) barrier;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p barrier wait %s:%i\n", b, filename, fileline);
+ Sys_Printf("%p barrier wait %s:%i\n", b, filename, fileline);
#endif
pthread_barrier_wait(b);
}
{
volatile barrier_t *b = (volatile barrier_t *) Z_Malloc(sizeof(barrier_t));
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p barrier create(%d) %s:%i\n", b, count, filename, fileline);
+ Sys_Printf("%p barrier create(%d) %s:%i\n", b, count, filename, fileline);
#endif
b->needed = count;
b->called = 0;
{
volatile barrier_t *b = (volatile barrier_t *) barrier;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p barrier destroy %s:%i\n", b, filename, fileline);
+ Sys_Printf("%p barrier destroy %s:%i\n", b, filename, fileline);
#endif
Thread_DestroyMutex(b->mutex);
Thread_DestroyCond(b->cond);
{
volatile barrier_t *b = (volatile barrier_t *) barrier;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p barrier wait %s:%i\n", b, filename, fileline);
+ Sys_Printf("%p barrier wait %s:%i\n", b, filename, fileline);
#endif
Thread_LockMutex(b->mutex);
b->called++;
{
void *mutex = SDL_CreateMutex();
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p mutex create %s:%i\n" , mutex, filename, fileline);
+ Sys_Printf("%p mutex create %s:%i\n" , mutex, filename, fileline);
#endif
return mutex;
}
void _Thread_DestroyMutex(void *mutex, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p mutex destroy %s:%i\n", mutex, filename, fileline);
+ Sys_Printf("%p mutex destroy %s:%i\n", mutex, filename, fileline);
#endif
SDL_DestroyMutex((SDL_mutex *)mutex);
}
int _Thread_LockMutex(void *mutex, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p mutex lock %s:%i\n" , mutex, filename, fileline);
+ Sys_Printf("%p mutex lock %s:%i\n" , mutex, filename, fileline);
#endif
return SDL_LockMutex((SDL_mutex *)mutex);
}
int _Thread_UnlockMutex(void *mutex, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p mutex unlock %s:%i\n" , mutex, filename, fileline);
+ Sys_Printf("%p mutex unlock %s:%i\n" , mutex, filename, fileline);
#endif
return SDL_UnlockMutex((SDL_mutex *)mutex);
}
{
void *cond = (void *)SDL_CreateCond();
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond create %s:%i\n" , cond, filename, fileline);
+ Sys_Printf("%p cond create %s:%i\n" , cond, filename, fileline);
#endif
return cond;
}
void _Thread_DestroyCond(void *cond, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond destroy %s:%i\n" , cond, filename, fileline);
+ Sys_Printf("%p cond destroy %s:%i\n" , cond, filename, fileline);
#endif
SDL_DestroyCond((SDL_cond *)cond);
}
int _Thread_CondSignal(void *cond, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond signal %s:%i\n" , cond, filename, fileline);
+ Sys_Printf("%p cond signal %s:%i\n" , cond, filename, fileline);
#endif
return SDL_CondSignal((SDL_cond *)cond);
}
int _Thread_CondBroadcast(void *cond, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond broadcast %s:%i\n" , cond, filename, fileline);
+ Sys_Printf("%p cond broadcast %s:%i\n" , cond, filename, fileline);
#endif
return SDL_CondBroadcast((SDL_cond *)cond);
}
int _Thread_CondWait(void *cond, void *mutex, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond wait %s:%i\n" , cond, filename, fileline);
+ Sys_Printf("%p cond wait %s:%i\n" , cond, filename, fileline);
#endif
return SDL_CondWait((SDL_cond *)cond, (SDL_mutex *)mutex);
}
{
void *thread = (void *)SDL_CreateThread(fn, filename, data);
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p thread create %s:%i\n" , thread, filename, fileline);
+ Sys_Printf("%p thread create %s:%i\n" , thread, filename, fileline);
#endif
return thread;
}
{
int status = retval;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p thread wait %s:%i\n" , thread, filename, fileline);
+ Sys_Printf("%p thread wait %s:%i\n" , thread, filename, fileline);
#endif
SDL_WaitThread((SDL_Thread *)thread, &status);
return status;
{
volatile barrier_t *b = (volatile barrier_t *) Z_Malloc(sizeof(barrier_t));
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p barrier create(%d) %s:%i\n", b, count, filename, fileline);
+ Sys_Printf("%p barrier create(%d) %s:%i\n", b, count, filename, fileline);
#endif
b->needed = count;
b->called = 0;
{
volatile barrier_t *b = (volatile barrier_t *) barrier;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p barrier destroy %s:%i\n", b, filename, fileline);
+ Sys_Printf("%p barrier destroy %s:%i\n", b, filename, fileline);
#endif
Thread_DestroyMutex(b->mutex);
Thread_DestroyCond(b->cond);
{
volatile barrier_t *b = (volatile barrier_t *) barrier;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p barrier wait %s:%i\n", b, filename, fileline);
+ Sys_Printf("%p barrier wait %s:%i\n", b, filename, fileline);
#endif
Thread_LockMutex(b->mutex);
b->called++;
int _Thread_AtomicGet(Thread_Atomic *a, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p atomic get at %s:%i\n", a, filename, fileline);
+ Sys_Printf("%p atomic get at %s:%i\n", a, filename, fileline);
#endif
return SDL_AtomicGet((SDL_atomic_t *)a);
}
int _Thread_AtomicSet(Thread_Atomic *a, int v, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p atomic set %v at %s:%i\n", a, v, filename, fileline);
+ Sys_Printf("%p atomic set %v at %s:%i\n", a, v, filename, fileline);
#endif
return SDL_AtomicSet((SDL_atomic_t *)a, v);
}
int _Thread_AtomicAdd(Thread_Atomic *a, int v, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p atomic add %v at %s:%i\n", a, v, filename, fileline);
+ Sys_Printf("%p atomic add %v at %s:%i\n", a, v, filename, fileline);
#endif
return SDL_AtomicAdd((SDL_atomic_t *)a, v);
}
void _Thread_AtomicIncRef(Thread_Atomic *a, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p atomic incref %s:%i\n", a, filename, fileline);
+ Sys_Printf("%p atomic incref %s:%i\n", a, filename, fileline);
#endif
SDL_AtomicIncRef((SDL_atomic_t *)a);
}
qbool _Thread_AtomicDecRef(Thread_Atomic *a, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p atomic decref %s:%i\n", a, filename, fileline);
+ Sys_Printf("%p atomic decref %s:%i\n", a, filename, fileline);
#endif
return SDL_AtomicDecRef((SDL_atomic_t *)a) != SDL_FALSE;
}
qbool _Thread_AtomicTryLock(Thread_SpinLock *lock, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p atomic try lock %s:%i\n", lock, filename, fileline);
+ Sys_Printf("%p atomic try lock %s:%i\n", lock, filename, fileline);
#endif
return SDL_AtomicTryLock(lock) != SDL_FALSE;
}
void _Thread_AtomicLock(Thread_SpinLock *lock, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p atomic lock %s:%i\n", lock, filename, fileline);
+ Sys_Printf("%p atomic lock %s:%i\n", lock, filename, fileline);
#endif
SDL_AtomicLock(lock);
}
void _Thread_AtomicUnlock(Thread_SpinLock *lock, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p atomic unlock %s:%i\n", lock, filename, fileline);
+ Sys_Printf("%p atomic unlock %s:%i\n", lock, filename, fileline);
#endif
SDL_AtomicUnlock(lock);
}
{
void *mutex = (void *)CreateMutex(NULL, FALSE, NULL);
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p mutex create %s:%i\n" , mutex, filename, fileline);
+ Sys_Printf("%p mutex create %s:%i\n" , mutex, filename, fileline);
#endif
return mutex;
}
void _Thread_DestroyMutex(void *mutex, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p mutex destroy %s:%i\n", mutex, filename, fileline);
+ Sys_Printf("%p mutex destroy %s:%i\n", mutex, filename, fileline);
#endif
CloseHandle(mutex);
}
int _Thread_LockMutex(void *mutex, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p mutex lock %s:%i\n" , mutex, filename, fileline);
+ Sys_Printf("%p mutex lock %s:%i\n" , mutex, filename, fileline);
#endif
return (WaitForSingleObject(mutex, INFINITE) == WAIT_FAILED) ? -1 : 0;
}
int _Thread_UnlockMutex(void *mutex, const char *filename, int fileline)
{
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p mutex unlock %s:%i\n" , mutex, filename, fileline);
+ Sys_Printf("%p mutex unlock %s:%i\n" , mutex, filename, fileline);
#endif
return (ReleaseMutex(mutex) == false) ? -1 : 0;
}
c->waiting = 0;
c->signals = 0;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond create %s:%i\n" , c, filename, fileline);
+ Sys_Printf("%p cond create %s:%i\n" , c, filename, fileline);
#endif
return c;
}
{
thread_cond_t *c = (thread_cond_t *)cond;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond destroy %s:%i\n" , cond, filename, fileline);
+ Sys_Printf("%p cond destroy %s:%i\n" , cond, filename, fileline);
#endif
Thread_DestroySemaphore(c->sem);
Thread_DestroySemaphore(c->done);
thread_cond_t *c = (thread_cond_t *)cond;
int n;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond signal %s:%i\n" , cond, filename, fileline);
+ Sys_Printf("%p cond signal %s:%i\n" , cond, filename, fileline);
#endif
WaitForSingleObject(c->mutex, INFINITE);
n = c->waiting - c->signals;
int i = 0;
int n = 0;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond broadcast %s:%i\n" , cond, filename, fileline);
+ Sys_Printf("%p cond broadcast %s:%i\n" , cond, filename, fileline);
#endif
WaitForSingleObject(c->mutex, INFINITE);
n = c->waiting - c->signals;
thread_cond_t *c = (thread_cond_t *)cond;
int waitresult;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p cond wait %s:%i\n" , cond, filename, fileline);
+ Sys_Printf("%p cond wait %s:%i\n" , cond, filename, fileline);
#endif
WaitForSingleObject(c->mutex, INFINITE);
{
threadwrapper_t *w = (threadwrapper_t *)calloc(sizeof(*w), 1);
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p thread create %s:%i\n" , w, filename, fileline);
+ Sys_Printf("%p thread create %s:%i\n" , w, filename, fileline);
#endif
w->fn = fn;
w->data = data;
{
threadwrapper_t *w = (threadwrapper_t *)d;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p thread wait %s:%i\n" , w, filename, fileline);
+ Sys_Printf("%p thread wait %s:%i\n" , w, filename, fileline);
#endif
WaitForSingleObject(w->handle, INFINITE);
CloseHandle(w->handle);
{
volatile barrier_t *b = (volatile barrier_t *) Z_Malloc(sizeof(barrier_t));
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p barrier create(%d) %s:%i\n", b, count, filename, fileline);
+ Sys_Printf("%p barrier create(%d) %s:%i\n", b, count, filename, fileline);
#endif
b->needed = count;
b->called = 0;
{
volatile barrier_t *b = (volatile barrier_t *) barrier;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p barrier destroy %s:%i\n", b, filename, fileline);
+ Sys_Printf("%p barrier destroy %s:%i\n", b, filename, fileline);
#endif
Thread_DestroyMutex(b->mutex);
Thread_DestroyCond(b->cond);
{
volatile barrier_t *b = (volatile barrier_t *) barrier;
#ifdef THREADDEBUG
- Sys_PrintfToTerminal("%p barrier wait %s:%i\n", b, filename, fileline);
+ Sys_Printf("%p barrier wait %s:%i\n", b, filename, fileline);
#endif
Thread_LockMutex(b->mutex);
b->called++;