Subversion Repositories Kolibri OS

Rev

Rev 5574 | Rev 5576 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5574 Rev 5575
Line 37... Line 37...
37
        EDI++;
37
        EDI++;
38
    }
38
    }
39
}
39
}
40
*/
40
*/
Line 41... Line 41...
41
 
41
 
42
int strspn(dword text1,text2)
42
inline int strspn(dword text1,text2)
43
{
43
{
44
	dword beg;
44
	dword beg;
45
	char s1,s2;
45
	char s1,s2;
46
	int ret;
46
	int ret;
Line 62... Line 62...
62
		$inc text1
62
		$inc text1
63
	} while(s1);
63
	} while(s1);
64
	return ret;
64
	return ret;
65
}
65
}
Line 66... Line 66...
66
 
66
 
67
dword strpbrk(dword text1,text2)
67
inline dword strpbrk(dword text1,text2)
68
{
68
{
69
	char s,ss;
69
	char s,ss;
70
	dword beg;
70
	dword beg;
71
	beg = text2;
71
	beg = text2;
Line 110... Line 110...
110
    $mov ecx, -1
110
    $mov ecx, -1
111
    $REPNE $SCASB
111
    $REPNE $SCASB
112
    EAX-=2+ECX;
112
    EAX-=2+ECX;
113
}
113
}
Line -... Line 114...
-
 
114
 
-
 
115
inline strnlen(dword str, dword maxlen)
-
 
116
{
-
 
117
	dword cp;
-
 
118
	for (cp = str; (maxlen != 0) && (DSBYTE[cp] != '\0'); cp++, maxlen--);
-
 
119
	return cp - str;
-
 
120
}
Line 114... Line 121...
114
 
121
 
115
 
122
 
116
signed int strcmp(dword text1, text2)
123
inline signed int strcmp(dword text1, text2)
117
{
124
{
118
	char s1,s2;
125
	char s1,s2;
119
	dword p1,p2;
126
	dword p1,p2;
Line 134... Line 141...
134
		$inc text2
141
		$inc text2
135
	}
142
	}
136
	return 0;
143
	return 0;
137
}
144
}
Line -... Line 145...
-
 
145
 
-
 
146
/*
-
 
147
signed int strncmp(dword s1, s2, signed n)
-
 
148
unsigned char _s1,_s2;
-
 
149
{
-
 
150
	if (n == 0)
-
 
151
		return 0;
-
 
152
	do {
-
 
153
		_s1 = DSBYTE[s1];
-
 
154
		_s2 = DSBYTE[s2];
-
 
155
		if (_s1 != _s2)
-
 
156
		{
-
 
157
			$dec s2
-
 
158
			return _s1 - _s2;
-
 
159
		}
-
 
160
		$inc s2
-
 
161
		if (_s1 == 0)
-
 
162
			break;
-
 
163
		$inc s1
-
 
164
		$dec n
-
 
165
	} while (n);
-
 
166
	return 0;
-
 
167
}
-
 
168
*/
Line 138... Line 169...
138
 
169
 
139
 
170
 
140
inline fastcall void strcpy( EDI, ESI)
171
inline fastcall void strcpy( EDI, ESI)
141
{
172
{
Line 145... Line 176...
145
    $stosb
176
    $stosb
146
    $test al,al
177
    $test al,al
147
    $jnz L2
178
    $jnz L2
148
}
179
}
Line 149... Line 180...
149
 
180
 
150
void strncpy(dword text1, text2, signed len)
181
inline dword strncpy(dword text1, text2, signed len)
151
	signed o1,o2;
182
	signed o1,o2;
152
{
183
{
153
	o1 = len/4;
184
	o1 = len/4;
154
	o2 = len-4*o1;
185
	o2 = len-4*o1;
Line 162... Line 193...
162
		ESBYTE[text1] = ESBYTE[text2];
193
		ESBYTE[text1] = ESBYTE[text2];
163
		$inc text1 
194
		$inc text1 
164
		$inc text2 
195
		$inc text2 
165
		$dec o2
196
		$dec o2
166
	}
197
	}
-
 
198
	ESBYTE[text1] = 0;
-
 
199
	return text1;
167
}
200
}
Line 168... Line 201...
168
 
201
 
169
inline fastcall int strlcpy(dword ESI, EDI, EBX)
202
inline fastcall int strlcpy(dword ESI, EDI, EBX)
170
{
203
{
Line 196... Line 229...
196
    DSBYTE[ESI] = '\0';
229
    DSBYTE[ESI] = '\0';
197
}
230
}
198
*/
231
*/
Line 199... Line 232...
199
 
232
 
200
byte __isWhite(int s){ if (s==13)||(s==32)||(s==10)||(s==9) return true; return false; }
233
byte __isWhite(int s){ if (s==13)||(s==32)||(s==10)||(s==9) return true; return false; }
201
void strltrim(dword text){
234
inline void strltrim(dword text){
202
	int s;
235
	int s;
203
	dword back_text;
236
	dword back_text;
204
	back_text = text;
237
	back_text = text;
205
	s = ESBYTE[text];
238
	s = ESBYTE[text];
Line 216... Line 249...
216
		$inc text
249
		$inc text
217
		s = ESBYTE[text];
250
		s = ESBYTE[text];
218
	};
251
	};
219
}
252
}
Line 220... Line 253...
220
 
253
 
221
void strrtrim(dword text)
254
inline void strrtrim(dword text)
222
{
255
{
223
	int s;
256
	int s;
224
	dword p;
257
	dword p;
225
	do {
258
	do {
Line 238... Line 271...
238
	$dec text
271
	$dec text
239
	s = ESBYTE[text];
272
	s = ESBYTE[text];
240
	if(__isWhite(s)) ESBYTE[p] = 0;
273
	if(__isWhite(s)) ESBYTE[p] = 0;
241
}
274
}
Line 242... Line 275...
242
 
275
 
243
void strtrim(dword text){
276
inline void strtrim(dword text){
244
	int s;
277
	int s;
245
	dword p,back_text;
278
	dword p,back_text;
246
	back_text = text;
279
	back_text = text;
247
	s = ESBYTE[text];
280
	s = ESBYTE[text];
Line 576... Line 609...
576
    $popa
609
    $popa
577
    return #buffer;
610
    return #buffer;
578
}
611
}
579
*/
612
*/
Line 580... Line 613...
580
	
613
	
581
dword itoa(signed long number)
614
inline dword itoa(signed long number)
582
{
615
{
583
	unsigned char buf[11];
616
	unsigned char buf[11];
584
	dword ret;
617
	dword ret;
585
	byte cmd;
618
	byte cmd;
Line 651... Line 684...
651
 
684
 
652
    $popa
685
    $popa
653
    return EBX;
686
    return EBX;
Line 654... Line 687...
654
} 
687
} 
655
 
688
 
656
dword strdup(dword text)
689
inline dword strdup(dword text)
657
{
690
{
658
    dword l = strlen(text);
691
    dword l = strlen(text);
659
    dword ret = malloc(l+1);
692
    dword ret = malloc(l+1);
660
    strncpy(ret,text,l);
693
    strncpy(ret,text,l);
Line -... Line 694...
-
 
694
    return ret;
-
 
695
}
-
 
696
 
-
 
697
inline dword strndup(dword str, signed maxlen)
-
 
698
{
-
 
699
	dword copy,len;
-
 
700
 
-
 
701
	len = strnlen(str, maxlen);
-
 
702
	copy = malloc(len + 1);
-
 
703
	if (copy != NULL)
-
 
704
	{
-
 
705
		memcpy(copy, str, len);
-
 
706
		DSBYTE[len+copy] = '\0';
-
 
707
	}
661
    return ret;
708
	return copy;
662
}
709
}
663
 
710
 
664
void debugi(dword d_int)
711
void debugi(dword d_int)
665
{
712
{