Subversion Repositories WoWGM

Rev

Rev 9 | Rev 18 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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