doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Macros | Typedefs | Enumerations | Functions | Variables
sys_public.h File Reference

Go to the source code of this file.

Classes

struct  sysEvent_s
 
struct  sysMemoryStats_s
 
class  idList< type >
 
struct  netadr_t
 
class  idPort
 
class  idTCP
 
struct  xthreadInfo
 
class  idSys
 

Macros

#define id_attribute(x)
 
#define SYS_MINSLEEP   20
 
#define PORT_ANY   -1
 

Typedefs

typedef struct sysEvent_s sysEvent_t
 
typedef struct sysMemoryStats_s sysMemoryStats_t
 
typedef unsigned long address_t
 
typedef unsigned int(* xthread_t )(void *)
 

Enumerations

enum  cpuid_t {
  CPUID_NONE = 0x00000, CPUID_UNSUPPORTED = 0x00001, CPUID_GENERIC = 0x00002, CPUID_INTEL = 0x00004,
  CPUID_AMD = 0x00008, CPUID_MMX = 0x00010, CPUID_3DNOW = 0x00020, CPUID_SSE = 0x00040,
  CPUID_SSE2 = 0x00080, CPUID_SSE3 = 0x00100, CPUID_ALTIVEC = 0x00200, CPUID_HTT = 0x01000,
  CPUID_CMOV = 0x02000, CPUID_FTZ = 0x04000, CPUID_DAZ = 0x08000
}
 
enum  fpuExceptions_t {
  FPU_EXCEPTION_INVALID_OPERATION = 1, FPU_EXCEPTION_DENORMALIZED_OPERAND = 2, FPU_EXCEPTION_DIVIDE_BY_ZERO = 4, FPU_EXCEPTION_NUMERIC_OVERFLOW = 8,
  FPU_EXCEPTION_NUMERIC_UNDERFLOW = 16, FPU_EXCEPTION_INEXACT_RESULT = 32
}
 
enum  fpuPrecision_t { FPU_PRECISION_SINGLE = 0, FPU_PRECISION_DOUBLE = 1, FPU_PRECISION_DOUBLE_EXTENDED = 2 }
 
enum  fpuRounding_t { FPU_ROUNDING_TO_NEAREST = 0, FPU_ROUNDING_DOWN = 1, FPU_ROUNDING_UP = 2, FPU_ROUNDING_TO_ZERO = 3 }
 
enum  joystickAxis_t {
  AXIS_SIDE, AXIS_FORWARD, AXIS_UP, AXIS_ROLL,
  AXIS_YAW, AXIS_PITCH, MAX_JOYSTICK_AXIS
}
 
enum  sysEventType_t {
  SE_NONE, SE_KEY, SE_CHAR, SE_MOUSE,
  SE_JOYSTICK_AXIS, SE_CONSOLE
}
 
enum  sys_mEvents {
  M_ACTION1, M_ACTION2, M_ACTION3, M_ACTION4,
  M_ACTION5, M_ACTION6, M_ACTION7, M_ACTION8,
  M_DELTAX, M_DELTAY, M_DELTAZ
}
 
enum  netadrtype_t { NA_BAD, NA_LOOPBACK, NA_BROADCAST, NA_IP }
 
enum  xthreadPriority { THREAD_NORMAL, THREAD_ABOVE_NORMAL, THREAD_HIGHEST }
 
enum  { CRITICAL_SECTION_ZERO = 0, CRITICAL_SECTION_ONE, CRITICAL_SECTION_TWO, CRITICAL_SECTION_THREE }
 
enum  { TRIGGER_EVENT_ZERO = 0, TRIGGER_EVENT_ONE, TRIGGER_EVENT_TWO, TRIGGER_EVENT_THREE }
 

Functions

void Sys_Init (void)
 
void Sys_Shutdown (void)
 
void Sys_Error (const char *error,...)
 
void Sys_Quit (void)
 
bool Sys_AlreadyRunning (void)
 
char * Sys_GetClipboardData (void)
 
void Sys_SetClipboardData (const char *string)
 
void Sys_Printf (const char *msg,...) id_attribute((format(printf
 
void void Sys_DebugPrintf (const char *fmt,...) id_attribute((format(printf
 
void void void Sys_DebugVPrintf (const char *fmt, va_list arg)
 
void Sys_Sleep (int msec)
 
int Sys_Milliseconds (void)
 
double Sys_GetClockTicks (void)
 
double Sys_ClockTicksPerSecond (void)
 
cpuid_t Sys_GetProcessorId (void)
 
const char * Sys_GetProcessorString (void)
 
bool Sys_FPU_StackIsEmpty (void)
 
void Sys_FPU_ClearStack (void)
 
const char * Sys_FPU_GetState (void)
 
void Sys_FPU_EnableExceptions (int exceptions)
 
void Sys_FPU_SetPrecision (int precision)
 
void Sys_FPU_SetRounding (int rounding)
 
void Sys_FPU_SetFTZ (bool enable)
 
void Sys_FPU_SetDAZ (bool enable)
 
int Sys_GetSystemRam (void)
 
int Sys_GetVideoRam (void)
 
int Sys_GetDriveFreeSpace (const char *path)
 
void Sys_GetCurrentMemoryStatus (sysMemoryStats_t &stats)
 
void Sys_GetExeLaunchMemoryStatus (sysMemoryStats_t &stats)
 
bool Sys_LockMemory (void *ptr, int bytes)
 
bool Sys_UnlockMemory (void *ptr, int bytes)
 
void Sys_SetPhysicalWorkMemory (int minBytes, int maxBytes)
 
void Sys_GetCallStack (address_t *callStack, const int callStackSize)
 
const char * Sys_GetCallStackStr (const address_t *callStack, const int callStackSize)
 
const char * Sys_GetCallStackCurStr (int depth)
 
const char * Sys_GetCallStackCurAddressStr (int depth)
 
void Sys_ShutdownSymbols (void)
 
int Sys_DLL_Load (const char *dllName)
 
voidSys_DLL_GetProcAddress (int dllHandle, const char *procName)
 
void Sys_DLL_Unload (int dllHandle)
 
void Sys_GenerateEvents (void)
 
sysEvent_t Sys_GetEvent (void)
 
void Sys_ClearEvents (void)
 
void Sys_InitInput (void)
 
void Sys_ShutdownInput (void)
 
void Sys_InitScanTable (void)
 
const unsigned char * Sys_GetScanTable (void)
 
unsigned char Sys_GetConsoleKey (bool shifted)
 
unsigned char Sys_MapCharForKey (int key)
 
int Sys_PollKeyboardInputEvents (void)
 
int Sys_ReturnKeyboardInputEvent (const int n, int &ch, bool &state)
 
void Sys_EndKeyboardInputEvents (void)
 
int Sys_PollMouseInputEvents (void)
 
int Sys_ReturnMouseInputEvent (const int n, int &action, int &value)
 
void Sys_EndMouseInputEvents (void)
 
void Sys_GrabMouseCursor (bool grabIt)
 
void Sys_ShowWindow (bool show)
 
bool Sys_IsWindowVisible (void)
 
void Sys_ShowConsole (int visLevel, bool quitOnClose)
 
void Sys_Mkdir (const char *path)
 
ID_TIME_T Sys_FileTimeStamp (FILE *fp)
 
const char * Sys_TimeStampToStr (ID_TIME_T timeStamp)
 
const char * Sys_DefaultCDPath (void)
 
const char * Sys_DefaultBasePath (void)
 
const char * Sys_DefaultSavePath (void)
 
const char * Sys_EXEPath (void)
 
int Sys_ListFiles (const char *directory, const char *extension, idList< class idStr > &list)
 
void Sys_SetFatalError (const char *error)
 
void Sys_DoPreferences (void)
 
bool Sys_StringToNetAdr (const char *s, netadr_t *a, bool doDNSResolve)
 
const char * Sys_NetAdrToString (const netadr_t a)
 
bool Sys_IsLANAddress (const netadr_t a)
 
bool Sys_CompareNetAdrBase (const netadr_t a, const netadr_t b)
 
void Sys_InitNetworking (void)
 
void Sys_ShutdownNetworking (void)
 
void Sys_CreateThread (xthread_t function, void *parms, xthreadPriority priority, xthreadInfo &info, const char *name, xthreadInfo *threads[MAX_THREADS], int *thread_count)
 
void Sys_DestroyThread (xthreadInfo &info)
 
const char * Sys_GetThreadName (int *index=0)
 
void Sys_EnterCriticalSection (int index=CRITICAL_SECTION_ZERO)
 
void Sys_LeaveCriticalSection (int index=CRITICAL_SECTION_ZERO)
 
void Sys_WaitForEvent (int index=TRIGGER_EVENT_ZERO)
 
void Sys_TriggerEvent (int index=TRIGGER_EVENT_ZERO)
 
bool Sys_LoadOpenAL (void)
 
void Sys_FreeOpenAL (void)
 

Variables

const int MAX_THREADS = 10
 
xthreadInfog_threads [MAX_THREADS]
 
int g_thread_count
 
const int MAX_CRITICAL_SECTIONS = 4
 
const int MAX_TRIGGER_EVENTS = 4
 
idSyssys
 

Macro Definition Documentation

#define id_attribute (   x)

Definition at line 139 of file sys_public.h.

#define PORT_ANY   -1

Definition at line 410 of file sys_public.h.

#define SYS_MINSLEEP   20

Definition at line 259 of file sys_public.h.

Typedef Documentation

typedef unsigned long address_t

Definition at line 234 of file sys_public.h.

typedef struct sysEvent_s sysEvent_t
typedef unsigned int(* xthread_t)(void *)

Definition at line 480 of file sys_public.h.

Enumeration Type Documentation

anonymous enum
Enumerator
CRITICAL_SECTION_ZERO 
CRITICAL_SECTION_ONE 
CRITICAL_SECTION_TWO 
CRITICAL_SECTION_THREE 

Definition at line 507 of file sys_public.h.

anonymous enum
Enumerator
TRIGGER_EVENT_ZERO 
TRIGGER_EVENT_ONE 
TRIGGER_EVENT_TWO 
TRIGGER_EVENT_THREE 

Definition at line 519 of file sys_public.h.

enum cpuid_t
Enumerator
CPUID_NONE 
CPUID_UNSUPPORTED 
CPUID_GENERIC 
CPUID_INTEL 
CPUID_AMD 
CPUID_MMX 
CPUID_3DNOW 
CPUID_SSE 
CPUID_SSE2 
CPUID_SSE3 
CPUID_ALTIVEC 
CPUID_HTT 
CPUID_CMOV 
CPUID_FTZ 
CPUID_DAZ 

Definition at line 142 of file sys_public.h.

Enumerator
FPU_EXCEPTION_INVALID_OPERATION 
FPU_EXCEPTION_DENORMALIZED_OPERAND 
FPU_EXCEPTION_DIVIDE_BY_ZERO 
FPU_EXCEPTION_NUMERIC_OVERFLOW 
FPU_EXCEPTION_NUMERIC_UNDERFLOW 
FPU_EXCEPTION_INEXACT_RESULT 

Definition at line 160 of file sys_public.h.

Enumerator
FPU_PRECISION_SINGLE 
FPU_PRECISION_DOUBLE 
FPU_PRECISION_DOUBLE_EXTENDED 

Definition at line 169 of file sys_public.h.

Enumerator
FPU_ROUNDING_TO_NEAREST 
FPU_ROUNDING_DOWN 
FPU_ROUNDING_UP 
FPU_ROUNDING_TO_ZERO 

Definition at line 175 of file sys_public.h.

Enumerator
AXIS_SIDE 
AXIS_FORWARD 
AXIS_UP 
AXIS_ROLL 
AXIS_YAW 
AXIS_PITCH 
MAX_JOYSTICK_AXIS 

Definition at line 182 of file sys_public.h.

Enumerator
NA_BAD 
NA_LOOPBACK 
NA_BROADCAST 
NA_IP 

Definition at line 397 of file sys_public.h.

Enumerator
M_ACTION1 
M_ACTION2 
M_ACTION3 
M_ACTION4 
M_ACTION5 
M_ACTION6 
M_ACTION7 
M_ACTION8 
M_DELTAX 
M_DELTAY 
M_DELTAZ 

Definition at line 201 of file sys_public.h.

Enumerator
SE_NONE 
SE_KEY 
SE_CHAR 
SE_MOUSE 
SE_JOYSTICK_AXIS 
SE_CONSOLE 

Definition at line 192 of file sys_public.h.

Enumerator
THREAD_NORMAL 
THREAD_ABOVE_NORMAL 
THREAD_HIGHEST 

Definition at line 482 of file sys_public.h.

Function Documentation

bool Sys_AlreadyRunning ( void  )

Definition at line 529 of file posix_main.cpp.

void Sys_ClearEvents ( void  )

Definition at line 328 of file posix_main.cpp.

double Sys_ClockTicksPerSecond ( void  )

Definition at line 283 of file main.cpp.

bool Sys_CompareNetAdrBase ( const netadr_t  a,
const netadr_t  b 
)

Definition at line 248 of file posix_net.cpp.

void Sys_CreateThread ( xthread_t  function,
void parms,
xthreadPriority  priority,
xthreadInfo info,
const char *  name,
xthreadInfo threads[MAX_THREADS],
int thread_count 
)

Definition at line 93 of file win_main.cpp.

void void Sys_DebugPrintf ( const char *  fmt,
  ... 
)
void void void Sys_DebugVPrintf ( const char *  fmt,
va_list  arg 
)

Definition at line 1009 of file posix_main.cpp.

const char* Sys_DefaultBasePath ( void  )

Definition at line 158 of file main.cpp.

const char* Sys_DefaultCDPath ( void  )

Definition at line 429 of file posix_main.cpp.

const char* Sys_DefaultSavePath ( void  )

Definition at line 119 of file main.cpp.

void Sys_DestroyThread ( xthreadInfo info)

Definition at line 189 of file posix_threads.cpp.

void* Sys_DLL_GetProcAddress ( int  dllHandle,
const char *  procName 
)

Definition at line 401 of file posix_main.cpp.

int Sys_DLL_Load ( const char *  dllName)

Definition at line 388 of file posix_main.cpp.

void Sys_DLL_Unload ( int  dllHandle)

Definition at line 415 of file posix_main.cpp.

void Sys_DoPreferences ( void  )

Definition at line 468 of file main.cpp.

void Sys_EndKeyboardInputEvents ( void  )

Definition at line 53 of file dedicated.cpp.

void Sys_EndMouseInputEvents ( void  )

Definition at line 47 of file dedicated.cpp.

void Sys_EnterCriticalSection ( int  index = CRITICAL_SECTION_ZERO)

Definition at line 61 of file posix_threads.cpp.

void Sys_Error ( const char *  error,
  ... 
)

Definition at line 156 of file macosx_sys.mm.

const char* Sys_EXEPath ( void  )

Definition at line 132 of file main.cpp.

ID_TIME_T Sys_FileTimeStamp ( FILE *  fp)

Definition at line 433 of file posix_main.cpp.

void Sys_FPU_ClearStack ( void  )

Definition at line 475 of file posix_main.cpp.

void Sys_FPU_EnableExceptions ( int  exceptions)

Definition at line 227 of file main.cpp.

const char* Sys_FPU_GetState ( void  )

Definition at line 478 of file posix_main.cpp.

void Sys_FPU_SetDAZ ( bool  enable)

Definition at line 475 of file main.cpp.

void Sys_FPU_SetFTZ ( bool  enable)

Definition at line 498 of file main.cpp.

void Sys_FPU_SetPrecision ( int  precision)

Definition at line 482 of file posix_main.cpp.

void Sys_FPU_SetRounding ( int  rounding)

Definition at line 873 of file win_cpu.cpp.

bool Sys_FPU_StackIsEmpty ( void  )

Definition at line 471 of file posix_main.cpp.

void Sys_FreeOpenAL ( void  )

Definition at line 1053 of file posix_main.cpp.

void Sys_GenerateEvents ( void  )

Definition at line 980 of file posix_main.cpp.

void Sys_GetCallStack ( address_t callStack,
const int  callStackSize 
)

Definition at line 87 of file stack.cpp.

const char* Sys_GetCallStackCurAddressStr ( int  depth)

Definition at line 133 of file stack.cpp.

const char* Sys_GetCallStackCurStr ( int  depth)

Definition at line 120 of file stack.cpp.

const char* Sys_GetCallStackStr ( const address_t callStack,
const int  callStackSize 
)

Definition at line 100 of file stack.cpp.

char* Sys_GetClipboardData ( void  )

Definition at line 100 of file macosx_sys.mm.

double Sys_GetClockTicks ( void  )

Definition at line 245 of file main.cpp.

unsigned char Sys_GetConsoleKey ( bool  shifted)

Definition at line 189 of file main.cpp.

void Sys_GetCurrentMemoryStatus ( sysMemoryStats_t stats)

Definition at line 355 of file posix_main.cpp.

int Sys_GetDriveFreeSpace ( const char *  path)

Definition at line 518 of file posix_main.cpp.

sysEvent_t Sys_GetEvent ( void  )

Definition at line 309 of file posix_main.cpp.

void Sys_GetExeLaunchMemoryStatus ( sysMemoryStats_t stats)

Definition at line 359 of file posix_main.cpp.

cpuid_t Sys_GetProcessorId ( void  )

Definition at line 209 of file main.cpp.

const char* Sys_GetProcessorString ( void  )

Definition at line 218 of file main.cpp.

const unsigned char* Sys_GetScanTable ( void  )

Definition at line 744 of file win_input.cpp.

int Sys_GetSystemRam ( void  )

Definition at line 339 of file main.cpp.

const char* Sys_GetThreadName ( int index = 0)

Definition at line 222 of file posix_threads.cpp.

int Sys_GetVideoRam ( void  )

Definition at line 65 of file dedicated.cpp.

void Sys_GrabMouseCursor ( bool  grabIt)

Definition at line 43 of file dedicated.cpp.

void Sys_Init ( void  )

Definition at line 137 of file macosx_sys.mm.

void Sys_InitInput ( void  )

Definition at line 39 of file dedicated.cpp.

void Sys_InitNetworking ( void  )

Definition at line 273 of file posix_net.cpp.

void Sys_InitScanTable ( void  )

Definition at line 52 of file main.cpp.

bool Sys_IsLANAddress ( const netadr_t  a)

Definition at line 208 of file posix_net.cpp.

bool Sys_IsWindowVisible ( void  )

Definition at line 461 of file win_main.cpp.

void Sys_LeaveCriticalSection ( int  index = CRITICAL_SECTION_ZERO)

Definition at line 80 of file posix_threads.cpp.

int Sys_ListFiles ( const char *  directory,
const char *  extension,
idList< class idStr > &  list 
)

Definition at line 198 of file posix_main.cpp.

bool Sys_LoadOpenAL ( void  )

Definition at line 396 of file sound.cpp.

bool Sys_LockMemory ( void ptr,
int  bytes 
)

Definition at line 490 of file posix_main.cpp.

unsigned char Sys_MapCharForKey ( int  key)

Definition at line 57 of file dedicated.cpp.

int Sys_Milliseconds ( void  )

Definition at line 49 of file test_scheduler.c.

void Sys_Mkdir ( const char *  path)

Definition at line 189 of file posix_main.cpp.

const char* Sys_NetAdrToString ( const netadr_t  a)

Definition at line 187 of file posix_net.cpp.

int Sys_PollKeyboardInputEvents ( void  )

Definition at line 51 of file dedicated.cpp.

int Sys_PollMouseInputEvents ( void  )

Definition at line 45 of file dedicated.cpp.

void Sys_Printf ( const char *  msg,
  ... 
)
void Sys_Quit ( void  )

Definition at line 173 of file macosx_sys.mm.

int Sys_ReturnKeyboardInputEvent ( const int  n,
int ch,
bool state 
)

Definition at line 55 of file dedicated.cpp.

int Sys_ReturnMouseInputEvent ( const int  n,
int action,
int value 
)

Definition at line 49 of file dedicated.cpp.

void Sys_SetClipboardData ( const char *  string)

Definition at line 460 of file posix_main.cpp.

void Sys_SetFatalError ( const char *  error)

Definition at line 164 of file posix_signal.cpp.

void Sys_SetPhysicalWorkMemory ( int  minBytes,
int  maxBytes 
)

Definition at line 508 of file posix_main.cpp.

void Sys_ShowConsole ( int  visLevel,
bool  quitOnClose 
)

Definition at line 424 of file posix_main.cpp.

void Sys_ShowWindow ( bool  show)

Definition at line 452 of file win_main.cpp.

void Sys_Shutdown ( void  )

Definition at line 198 of file main.cpp.

void Sys_ShutdownInput ( void  )

Definition at line 41 of file dedicated.cpp.

void Sys_ShutdownNetworking ( void  )

Definition at line 724 of file win_net.cpp.

void Sys_ShutdownSymbols ( void  )

Definition at line 35 of file stack.cpp.

void Sys_Sleep ( int  msec)

Definition at line 67 of file macosx_sys.mm.

bool Sys_StringToNetAdr ( const char *  s,
netadr_t a,
bool  doDNSResolve 
)

Definition at line 171 of file posix_net.cpp.

const char* Sys_TimeStampToStr ( ID_TIME_T  timeStamp)

Definition at line 164 of file sys_local.cpp.

void Sys_TriggerEvent ( int  index = TRIGGER_EVENT_ZERO)

Definition at line 133 of file posix_threads.cpp.

bool Sys_UnlockMemory ( void ptr,
int  bytes 
)

Definition at line 499 of file posix_main.cpp.

void Sys_WaitForEvent ( int  index = TRIGGER_EVENT_ZERO)

Definition at line 113 of file posix_threads.cpp.

Variable Documentation

int g_thread_count

Definition at line 155 of file posix_threads.cpp.

xthreadInfo* g_threads[MAX_THREADS]

Definition at line 153 of file posix_threads.cpp.

const int MAX_CRITICAL_SECTIONS = 4

Definition at line 505 of file sys_public.h.

const int MAX_THREADS = 10

Definition at line 494 of file sys_public.h.

const int MAX_TRIGGER_EVENTS = 4

Definition at line 517 of file sys_public.h.

idSys* sys

Definition at line 48 of file maya_main.cpp.