-
Notifications
You must be signed in to change notification settings - Fork 0
/
platform.h
56 lines (51 loc) · 1.5 KB
/
platform.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef PLATFORM_UNKNOWN
#ifndef SHAREDMEMORY_PLATFORM_H
#define SHAREDMEMORY_PLATFORM_H
//general definition
typedef unsigned char* PBYTE;
typedef unsigned char BYTE;
typedef const char* STRING;
#define RETCODE unsigned int
//platform definition
#define POINTER_SIZE 8 //64Bit
#ifdef PLATFORM_WINDOWS
#include "windows.h"
typedef void* mutex_t;
typedef void* event_t;
typedef signed char INT8;
typedef signed short INT16;
typedef signed int INT32;
typedef signed long long INT64;
typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned int UINT32;
typedef unsigned long long UINT64;
typedef float FLOAT32;
typedef double FLOAT64;
#define BOOL_TRUE 0x00
#define BOOL_FALSE 0xff
typedef struct mapping_key_t{
STRING KeyValue;
mutex_t MUTEX;
int MappingSize;
void* MappingHandle;
void* MemoryPointer;
UINT8 isCreated;
} MAPPING_KEY,*PMAPPING_KEY;
#define LOCK(mutex) WaitForSingleObject(mutex, INFINITE)
#define UNLOCK(mutex) TryReleaseMutex(mutex)
#define GetProcessID() GetCurrentProcessId()
#define WaitForEvent(event) WaitForSingleObject(event, INFINITE)
#define TryForEvent(event) WaitForSingleObject(event, 0)
#define ActivateEvent(event) SetEvent(event)
#define TryActivateEvent(event) PulseEvent(event)
#define InhibitEvent(event) ResetEvent(event)
#define BOOLTOWINBOOL(val) val==BOOL_TRUE?TRUE:FALSE
HANDLE CreateOrOpenEvent(STRING name, UINT8 use_manual_mode);
void TryReleaseMutex(HANDLE mutex);
#endif
#ifdef PLATFORM_LINUX
#define MAPPING_KEY key_t;
#endif
#endif
#endif