123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- #ifndef _INC_ODPLAT
- #define _INC_ODPLAT
- #include <time.h>
- #include "ODTypes.h"
- #include "ODGen.h"
- #ifdef ODPLAT_NIX
- #include <sys/time.h>
- #endif
- #ifdef ODPLAT_WIN32
- #include "windows.h"
- #endif
- void ODPlatInit(void);
- typedef struct
- {
- #ifdef ODPLAT_DOS
- clock_t Start;
- clock_t Duration;
- #elif defined(ODPLAT_NIX)
- time_t Start;
- tODMilliSec Duration;
- #else
- tODMilliSec Start;
- tODMilliSec Duration;
- #endif
- } tODTimer;
- void ODTimerStart(tODTimer *pTimer, tODMilliSec Duration);
- BOOL ODTimerElapsed(tODTimer *pTimer);
- void ODTimerWaitForElapse(tODTimer *pTimer);
- tODMilliSec ODTimerLeft(tODTimer *pTimer);
- #ifdef OD_MULTITHREADED
- #ifdef ODPLAT_WIN32
- typedef HANDLE tODThreadHandle;
- #endif
- typedef enum
- {
- OD_PRIORITY_LOWEST,
- OD_PRIORITY_BELOW_NORMAL,
- OD_PRIORITY_NORMAL,
- OD_PRIORITY_ABOVE_NORMAL,
- OD_PRIORITY_HIGHEST
- } tODThreadPriority;
- #define OD_THREAD_FUNC WINAPI
- #ifdef ODPLAT_WIN32
- typedef DWORD (OD_THREAD_FUNC ptODThreadProc)(void *);
- #endif
- tODResult ODThreadCreate(tODThreadHandle *phThread,
- ptODThreadProc *pfThreadProc, void *pThreadParam);
- void ODThreadExit();
- tODResult ODThreadTerminate(tODThreadHandle hThread);
- tODResult ODThreadSuspend(tODThreadHandle hThread);
- tODResult ODThreadResume(tODThreadHandle hThread);
- tODResult ODThreadSetPriority(tODThreadHandle hThread,
- tODThreadPriority ThreadPriority);
- void ODThreadWaitForExit(tODThreadHandle hThread);
- tODThreadHandle ODThreadGetCurrent(void);
- #ifdef ODPLAT_WIN32
- typedef HANDLE tODSemaphoreHandle;
- #endif
- tODResult ODSemaphoreAlloc(tODSemaphoreHandle *phSemaphore, INT nInitialCount,
- INT nMaximumCount);
- void ODSemaphoreFree(tODSemaphoreHandle hSemaphore);
- void ODSemaphoreUp(tODSemaphoreHandle hSemaphore, INT nIncrementBy);
- tODResult ODSemaphoreDown(tODSemaphoreHandle hSemaphore, tODMilliSec Timeout);
- #endif
- void ODProcessExit(INT nExitCode);
- #ifdef ODPLAT_DOS
- typedef enum
- {
- kMultitaskerNone,
- kMultitaskerDV,
- kMultitaskerWin,
- kMultitaskerOS2
- } tODMultitasker;
- extern tODMultitasker ODMultitasker;
- #endif
- typedef tODHandle tODDirHandle;
- #define DIR_FILENAME_SIZE 1024
- #define DIR_ATTRIB_NORMAL 0x00
- #define DIR_ATTRIB_RDONLY 0x01
- #define DIR_ATTRIB_HIDDEN 0x02
- #define DIR_ATTRIB_SYSTEM 0x04
- #define DIR_ATTRIB_LABEL 0x08
- #define DIR_ATTRIB_DIREC 0x10
- #define DIR_ATTRIB_ARCH 0x20
- typedef struct
- {
- char szFileName[DIR_FILENAME_SIZE];
- WORD wAttributes;
- time_t LastWriteTime;
- DWORD dwFileSize;
- } tODDirEntry;
- tODResult ODDirOpen(CONST char *pszPath, WORD wAttributes, tODDirHandle *phDir);
- tODResult ODDirRead(tODDirHandle hDir, tODDirEntry *pDirEntry);
- void ODDirClose(tODDirHandle hDir);
- void ODDirChangeCurrent(char *pszPath);
- void ODDirGetCurrent(char *pszPath, INT nMaxPathChars);
- tODResult ODFileDelete(CONST char *pszPath);
- BOOL ODFileAccessMode(char *pszFilename, int nAccessMode);
- #endif
|