Subversion Repositories WoWGM

Rev

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

Rev 3 Rev 9
Line 1... Line 1...
1
#include "../H/STPL.h"
1
#include "../H/STPL.h"
2
 
2
 
-
 
3
 
3
/****************************************************************************
4
/****************************************************************************
4
*
5
*
5
*	Private functions
6
*	Private functions
6
*
7
*
7
***/
8
***/
-
 
9
 
8
//===========================================================================
10
//===========================================================================
9
int ToLower(int ch)
11
int ToLower(int ch)
10
{
12
{
11
	if (ch > 96 && ch < 123)
13
	if (ch > 64 && ch < 91)
12
		ch-=32;
14
		ch+=32;
13
	return ch;
15
	return ch;
14
}
16
}
15
 
17
 
16
//===========================================================================
18
//===========================================================================
17
int ToUpper(int ch)
19
int ToUpper(int ch)
18
{
20
{
19
	if (ch > 64 && ch < 91)
21
	if (ch > 96 && ch < 123)
20
		ch+=32;
22
		ch-=32;
21
	return ch;
23
	return ch;
22
}
24
}
23
 
25
 
24
 
26
 
25
/****************************************************************************
27
/****************************************************************************
26
*
28
*
27
*	External functions
29
*	External functions
28
*
30
*
29
***/
31
***/
-
 
32
 
-
 
33
//===========================================================================
-
 
34
char const* SStrChr(char const* string, char ch)
-
 
35
{
-
 
36
	// TODO: ASSERT(string);
-
 
37
	if (*string == 0)
-
 
38
		return 0;
-
 
39
	char const* copy = string;
-
 
40
	char currChar = *string;
-
 
41
	while (currChar != ch) {
-
 
42
		currChar = *++copy;
-
 
43
		if (currChar == 0)
-
 
44
			return 0;
-
 
45
	}
-
 
46
	return copy;
-
 
47
}
-
 
48
 
-
 
49
//===========================================================================
-
 
50
char* SStrChr(char* string, char ch)
-
 
51
{
-
 
52
	// TODO: ASSERT(string);
-
 
53
	if (*string == 0)
-
 
54
		return 0;
-
 
55
	char* copy = string;
-
 
56
	char currChar = *string;
-
 
57
	while (currChar != ch) {
-
 
58
		currChar = *++copy;
-
 
59
		if (currChar == 0)
-
 
60
			return 0;
-
 
61
	}
-
 
62
	return copy;
-
 
63
}
-
 
64
 
-
 
65
//===========================================================================
-
 
66
extern char const* SStrChrR(char const* string, char ch)
-
 
67
{
-
 
68
	return 0;
-
 
69
}
-
 
70
 
-
 
71
//===========================================================================
-
 
72
extern char* SStrChrR(char* string, char ch)
-
 
73
{
-
 
74
	return 0;
-
 
75
}
-
 
76
 
30
//===========================================================================
77
//===========================================================================
31
inline unsigned long SStrCopy(char* dest, char const* source, unsigned long destsize)
78
extern DWORD SStrCopy(char* dest, char const* source, DWORD destsize)
32
{
79
{
33
	// TODO: ASSERT(dest);
80
	// TODO: ASSERT(dest);
34
	// TODO: ASSERT(source);
81
	// TODO: ASSERT(source);
35
 
82
 
36
	unsigned long i;
83
	DWORD i;
37
	for (i = 0; i <= destsize; i++)
84
	for (i = 0; i < destsize; i++)
38
	{
85
	{
39
		dest[i] = source[i];
86
		dest[i] = source[i];
40
		if (*source == '\0')
87
		if (*source == '\0')
41
			break;
88
			break;
42
	}
89
	}
43
	return i;
90
	return i;
44
}
91
}
45
 
92
 
46
//===========================================================================
93
//===========================================================================
47
int SStrCmp(char const* string1, char const* string2, unsigned long maxchars)
94
extern int SStrCmp(char const* string1, char const* string2, DWORD maxchars)
48
{
95
{
49
	// TODO: ASSERT(string1);
96
	// TODO: ASSERT(string1);
50
	// TODO: ASSERT(string2);
97
	// TODO: ASSERT(string2);
51
	return 0;
98
	return 0;
52
}
99
}
53
 
100
 
54
//===========================================================================
101
//===========================================================================
55
int SStrCmpI(char const* string1, char const* string2, unsigned long maxchars)
102
extern int SStrCmpI(char const* string1, char const* string2, DWORD maxchars)
56
{
103
{
57
	// TODO: ASSERT(string1);
104
	// TODO: ASSERT(string1);
58
	// TODO: ASSERT(string2);
105
	// TODO: ASSERT(string2);
59
	return 0;
106
	return 0;
60
}
107
}
61
 
108
 
62
//===========================================================================
109
//===========================================================================
63
inline unsigned long SStrLen(char const* string)
110
inline DWORD SStrLen(char const* string)
64
{
111
{
65
	// TODO: ASSERT(string);
112
	// TODO: ASSERT(string);
66
 
113
 
67
	char const* i;
114
	char const* i;
68
	for (i = string; *i; ++i);
115
	for (i = string; *i; ++i);
69
	return static_cast<unsigned long>(i - string);
116
	return static_cast<DWORD>(i - string);
70
}
117
}
71
 
118
 
72
//===========================================================================
119
//===========================================================================
73
inline unsigned long SStrLen(unsigned short const* string)
120
inline DWORD SStrLen(unsigned short const* string)
74
{
121
{
75
	// TODO: ASSERT(string);
122
	// TODO: ASSERT(string);
76
 
123
 
77
	unsigned short const* i;
124
	unsigned short const* i;
78
	for (i = string; *i; ++i);
125
	for (i = string; *i; ++i);
79
	return static_cast<unsigned long>(i - string);
126
	return static_cast<DWORD>(i - string);
80
}
127
}
81
 
128
 
82
//===========================================================================
129
//===========================================================================
83
void SStrLower(char* string)
130
void SStrLower(char* string)
84
{
131
{