Subversion Repositories WoWGM

Rev

Rev 3 | Rev 10 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 9
Line -... Line 1...
-
 
1
#ifdef	_WIN32
-
 
2
#define NOCOMM
-
 
3
#define NOSOUND
-
 
4
#include <Windows.h>
-
 
5
#endif//_WIN32
1
 
6
 
-
 
7
 
-
 
8
/****************************************************************************
-
 
9
*
-
 
10
*	TYPE DEFINITIONS
-
 
11
*
-
 
12
***/
-
 
13
 
-
 
14
typedef char i8;
-
 
15
typedef char int8;
-
 
16
typedef short i16;
-
 
17
typedef short int16;
-
 
18
typedef int BOOL;
-
 
19
typedef int i32;
-
 
20
typedef int int32;
-
 
21
typedef unsigned char u8;
-
 
22
typedef unsigned char uchar;
-
 
23
typedef unsigned char uint8;
-
 
24
typedef unsigned short u16;
-
 
25
typedef unsigned short ushort;
-
 
26
typedef unsigned short uint16;
-
 
27
typedef unsigned int u32;
-
 
28
typedef unsigned int uint;
-
 
29
typedef unsigned int uint32;
-
 
30
typedef unsigned long ulong;
-
 
31
typedef unsigned long DWORD;
-
 
32
typedef void* LPVOID;
-
 
33
typedef void* HANDLE;
-
 
34
 
-
 
35
 
-
 
36
/****************************************************************************
-
 
37
*
-
 
38
*	SSTR FUNCTIONS
-
 
39
*
-
 
40
***/
-
 
41
 
-
 
42
extern char const* SStrChr(char const* string, char ch);
-
 
43
extern char* SStrChr(char* string, char ch);
-
 
44
extern char const* SStrChrR(char const* string, char ch);
-
 
45
extern char* SStrChrR(char* string, char ch);
2
extern unsigned long SStrCopy(char* dest, char const* source, unsigned long destsize);
46
extern DWORD SStrCopy(char* dest, char const* source, DWORD destsize);
3
extern int SStrCmp(char const* string1, char const* string2, unsigned long maxchars);
47
extern int SStrCmp(char const* string1, char const* string2, DWORD maxchars);
4
extern int SStrCmpI(char const* string1, char const* string2, unsigned long maxchars);
48
extern int SStrCmpI(char const* string1, char const* string2, DWORD maxchars);
5
extern unsigned long SStrLen(char const* string);
49
extern DWORD SStrLen(char const* string);
6
extern unsigned long SStrLen(unsigned short const* string);
50
extern DWORD SStrLen(unsigned short const* string);
7
extern void SStrLower(char* string);
51
extern void SStrLower(char* string);
8
extern void SStrUpper(char* string);
52
extern void SStrUpper(char* string);
-
 
53
 
-
 
54
 
-
 
55
/****************************************************************************
-
 
56
*
-
 
57
*	SSYNCOBJECT CLASS
-
 
58
*
-
 
59
***/
-
 
60
 
-
 
61
class SSyncObject
-
 
62
{
-
 
63
 
-
 
64
public:
-
 
65
	
-
 
66
	SSyncObject();
-
 
67
	~SSyncObject();
-
 
68
 
-
 
69
	void Close();
-
 
70
	BOOL Valid();
-
 
71
	DWORD Wait(DWORD timeoutMs);
-
 
72
 
-
 
73
	HANDLE m_opaqueData;
-
 
74
 
-
 
75
};
-
 
76
 
-
 
77
 
-
 
78
/****************************************************************************
-
 
79
*
-
 
80
*	STORM THREADING
-
 
81
*
-
 
82
***/
-
 
83
 
-
 
84
#ifdef	_WIN32
-
 
85
typedef DWORD(WINAPI THREADCALLBACK)(LPVOID);
-
 
86
#else
-
 
87
typedef LPVOID(THREADCALLBACK)(LPVOID);
-
 
88
#endif//_WIN32
-
 
89
 
-
 
90
extern HANDLE SCreateThread(THREADCALLBACK*	lpStartAddress,
-
 
91
							LPVOID			lpParameter,
-
 
92
							DWORD*			lpThreadId,
-
 
93
							char*			threadName);
-
 
94
 
-
 
95
/****************************************************************************
-
 
96
*
-
 
97
*	STHREAD CLASS
-
 
98
*
-
 
99
***/
-
 
100
 
-
 
101
class SThread : public SSyncObject
-
 
102
{
-
 
103
 
-
 
104
public:
-
 
105
 
-
 
106
	SThread();
-
 
107
	~SThread();
-
 
108
 
-
 
109
	static BOOL Create(THREADCALLBACK*	lpStartAddress,
-
 
110
					   LPVOID			param,
-
 
111
					   SThread&			thread,
-
 
112
					   char*			threadName) {
-
 
113
		thread.m_opaqueData = SCreateThread(lpStartAddress, param, 0, threadName);
-
 
114
		return thread.m_opaqueData != 0;
-
 
115
	}
-
 
116
 
-
 
117
};