Subversion Repositories Kolibri OS

Rev

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

Rev 7752 Rev 7757
Line 113... Line 113...
113
L1:
113
L1:
114
  }
114
  }
115
}
115
}
Line 116... Line 116...
116
 
116
 
-
 
117
/*
-
 
118
signed int strncmp(dword s1, s2, signed n)
-
 
119
unsigned char _s1,_s2;
-
 
120
{
-
 
121
	if (n == 0)
-
 
122
		return 0;
-
 
123
	do {
-
 
124
		_s1 = DSBYTE[s1];
-
 
125
		_s2 = DSBYTE[s2];
-
 
126
		if (_s1 != _s2)
-
 
127
		{
-
 
128
			$dec s2
-
 
129
			return _s1 - _s2;
-
 
130
		}
-
 
131
		$inc s2
-
 
132
		if (_s1 == 0)
-
 
133
			break;
-
 
134
		$inc s1
-
 
135
		$dec n
-
 
136
	} while (n);
-
 
137
	return 0;
-
 
138
}
-
 
139
*/
-
 
140
 
117
/*
141
/*
118
inline signed int strncmp(dword text1,text2,len)
142
inline signed int strncmp(dword text1,text2,len)
Line 119... Line 143...
119
{
143
{
120
	
144
	
Line 132... Line 156...
132
	$mov ecx, -1
156
	$mov ecx, -1
133
	$REPNE $SCASB
157
	$REPNE $SCASB
134
	EAX-=2+ECX;
158
	EAX-=2+ECX;
135
}
159
}
Line 136... Line 160...
136
 
160
 
137
inline strnlen(dword str, dword maxlen)
161
inline dword strnlen(dword str, dword maxlen)
138
{
162
{
139
	dword cp;
163
	dword cp;
140
	for (cp = str; (maxlen != 0) && (DSBYTE[cp] != '\0'); cp++, maxlen--);
164
	for (cp = str; (maxlen != 0) && (DSBYTE[cp] != '\0'); cp++, maxlen--);
141
	return cp - str;
165
	return cp - str;
Line 179... Line 203...
179
		$inc text2
203
		$inc text2
180
	}
204
	}
181
	return 0;
205
	return 0;
182
}
206
}
Line 183... Line -...
183
 
-
 
184
/*
-
 
185
TODO: rewrite streq() using pure assembliy
-
 
186
 
-
 
187
inline fastcall void strcpy( EDI, ESI)
-
 
188
{
-
 
189
    $cld
-
 
190
L2:
-
 
191
    $lodsb
-
 
192
    $stosb
-
 
193
    $test al,al
-
 
194
    $jnz L2
-
 
195
}
-
 
Line 196... Line 207...
196
*/
207
 
197
 
208
 
198
inline fastcall streq(ESI, EDI)
209
inline fastcall streq(ESI, EDI)
199
{
210
{
Line 210... Line 221...
210
		EDI++;
221
		EDI++;
211
	}
222
	}
212
	return true;
223
	return true;
213
}
224
}
Line 214... Line -...
214
 
-
 
215
/*
-
 
216
signed int strncmp(dword s1, s2, signed n)
-
 
217
unsigned char _s1,_s2;
-
 
218
{
-
 
219
	if (n == 0)
-
 
220
		return 0;
-
 
221
	do {
-
 
222
		_s1 = DSBYTE[s1];
-
 
223
		_s2 = DSBYTE[s2];
-
 
224
		if (_s1 != _s2)
-
 
225
		{
-
 
226
			$dec s2
-
 
227
			return _s1 - _s2;
-
 
228
		}
-
 
229
		$inc s2
-
 
230
		if (_s1 == 0)
-
 
231
			break;
-
 
232
		$inc s1
-
 
233
		$dec n
-
 
234
	} while (n);
-
 
235
	return 0;
-
 
236
}
-
 
237
*/
-
 
238
 
-
 
239
 
225
 
240
inline fastcall void strcpy( EDI, ESI)
226
inline fastcall void strcpy( EDI, ESI)
241
{
227
{
242
    $cld
228
    $cld
243
L2:
229
L2:
Line 393... Line 379...
393
    rep movsb
379
    rep movsb
394
    mov eax, ebx
380
    mov eax, ebx
395
    }
381
    }
396
}
382
}
Line 397... Line 383...
397
 
383
 
398
:void strncat(dword dst, src, dword len)
384
:void strncat(dword dst, src, len)
399
{
385
{
400
	while (ESBYTE[dst]) && (len) {
386
	while (ESBYTE[dst]) && (len) {
401
		dst++;
387
		dst++;
402
		len--;
388
		len--;
403
	}
389
	}
404
	while (ESBYTE[src]) && (len) {
390
	while (ESBYTE[src]) && (len>1) {
405
		ESBYTE[dst] = ESBYTE[src];
391
		ESBYTE[dst] = ESBYTE[src];
406
		dst++;
392
		dst++;
407
		src++;
393
		src++;
408
		len--;
394
		len--;
409
	}
395
	}
410
	ESBYTE[dst] = 0;
396
	ESBYTE[dst] = 0;
Line -... Line 397...
-
 
397
}
-
 
398
 
-
 
399
:void chrncat(dword dst, unsigned char s, dword len)
-
 
400
{
-
 
401
	while (ESBYTE[dst]) && (len) {
-
 
402
		dst++;
-
 
403
		len--;
-
 
404
	}
-
 
405
	if (len>1) {
-
 
406
		ESBYTE[dst] = s;
-
 
407
		ESBYTE[dst+1] = 0;
-
 
408
	}
411
}
409
}
412
 
410
 
413
inline fastcall void chrcat(ESI, DI)
411
inline fastcall void chrcat(ESI, DI)
414
{
412
{
415
    while (ESBYTE[ESI]) ESI++;
413
    while (ESBYTE[ESI]) ESI++;