Subversion Repositories Kolibri OS

Rev

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

Rev 5591 Rev 5598
Line -... Line 1...
-
 
1
#ifndef INCLUDE_STRING_H
-
 
2
#define INCLUDE_STRING_H
-
 
3
 
-
 
4
#ifndef INCLUDE_KOLIBRI_H
-
 
5
#include "../lib/kolibri.h"
-
 
6
#endif
-
 
7
 
-
 
8
#ifndef INCLUDE_MEM_H
-
 
9
#include "../lib/mem.h"
-
 
10
#endif
-
 
11
 
1
//------------------------------------------------------------------------------
12
//------------------------------------------------------------------------------
2
// strspn(dword text1,text2) --- example: strspn("12 year","1234567890") -> return 2
13
// strspn(dword text1,text2) --- example: strspn("12 year","1234567890") -> return 2
3
// strpbrk(dword text1,text2) --- example: strpbrk("this test", " ckfi") -> return "is test"
14
// strpbrk(dword text1,text2) --- example: strpbrk("this test", " ckfi") -> return "is test"
4
// strcmp( ESI, EDI)
15
// strcmp( ESI, EDI)
5
// strlen( EDI)
16
// strlen( EDI)
Line 37... Line 48...
37
        EDI++;
48
        EDI++;
38
    }
49
    }
39
}
50
}
40
*/
51
*/
Line -... Line 52...
-
 
52
 
-
 
53
 
41
 
54
 
42
inline int strspn(dword text1,text2)
55
inline int strspn(dword text1,text2)
43
{
56
{
44
	dword beg;
57
	dword beg;
45
	char s1,s2;
58
	char s1,s2;
Line 374... Line 387...
374
    ESBYTE[ESI+EDI] = BL;
387
    ESBYTE[ESI+EDI] = BL;
375
    ESBYTE[ESI+EDI+1] = 0;
388
    ESBYTE[ESI+EDI+1] = 0;
376
}
389
}
Line 377... Line 390...
377
 
390
 
378
 
391
 
379
inline fastcall signed int strchr( ESI,BL)
392
/*inline fastcall signed int strchr( ESI,BL)
380
{
393
{
381
    int jj=0;
394
    int jj=0;
382
    do{
395
    do{
383
        jj++;
396
        jj++;
384
        $lodsb
397
        $lodsb
385
        IF(AL==BL) return jj;
398
        IF(AL==BL) return jj;
386
    } while(AL!=0);
399
    } while(AL!=0);
Line -... Line 400...
-
 
400
    return 0;
-
 
401
}*/
-
 
402
 
-
 
403
inline dword strchr(dword shb;char s)
-
 
404
{
-
 
405
	char ss;
-
 
406
	loop()
-
 
407
	{
-
 
408
		ss = DSBYTE[shb];
-
 
409
		if(!ss)return 0;
-
 
410
		if(ss==s)return shb;
Line 387... Line 411...
387
    return 0;
411
		shb++;
388
}
412
	}
389
 
413
}
390
 
414
 
Line 730... Line 754...
730
 
754
 
731
inline dword hexdec(dword text)
755
inline dword hexdec(dword text)
732
{
756
{
733
	char s;
757
	char s;
734
	dword ret,l;
-
 
735
	//l = strlen(text);
758
	dword ret,l;
736
	ret = 0;
759
	ret = 0;
737
	s = DSBYTE[text];
-
 
738
	//if(l==6) 
760
	s = DSBYTE[text];
739
	while(s)
761
	while(s)
740
	{	
762
	{	
741
		ret <<= 4;
763
		ret <<= 4;
742
		if(s>='A')&&(s<='F')ret |= s-'A'+10;
764
		if(s>='A')&&(s<='F')ret |= s-'A'+10;
743
		else if(s>='a')&&(s<='f')ret |= s-'a'+10;
765
		else if(s>='a')&&(s<='f')ret |= s-'a'+10;
744
		else if(s>='0')&&(s<='9')ret |= s-'a'+10;
766
		else if(s>='0')&&(s<='9')ret |= s-'0';
745
		text++;
767
		text++;
746
		s = DSBYTE[text];
768
		s = DSBYTE[text];
-
 
769
	}
-
 
770
	return ret;
-
 
771
}
-
 
772
 
-
 
773
inline signed csshexdec(dword text)
-
 
774
{
-
 
775
	char s;
-
 
776
	dword ret,l;
-
 
777
	byte tmp;
-
 
778
	l = strlen(text);
-
 
779
	ret = 0;
-
 
780
	s = DSBYTE[text];
747
	}
781
	tmp = 0;
748
	/*else if(l==3) while(s)
782
	if(l==6) while(s)
749
	{	
783
	{	
750
		ret <<= 4;
784
		ret <<= 4;
751
		if(s>='A')&&(s<='F')ret |= s-'A'+10;
785
		if(s>='A')&&(s<='F')ret |= s-'A'+10;
752
		else if(s>='a')&&(s<='f')ret |= s-'a'+10;
786
		else if(s>='a')&&(s<='f')ret |= s-'a'+10;
753
		else if(s>='0')&&(s<='9')ret |= s-'a'+10;
787
		else if(s>='0')&&(s<='9')ret |= s-'0';
754
		text++;
788
		text++;
755
		s = DSBYTE[text];
789
		s = DSBYTE[text];
-
 
790
	}
-
 
791
	else if(l==3) while(s)
-
 
792
	{	
-
 
793
		ret |= tmp;
-
 
794
		ret <<= 4;
-
 
795
		ret |= tmp;
-
 
796
		ret <<= 4;
-
 
797
		if(s>='A')&&(s<='F')tmp = s-'A'+10;
-
 
798
		else if(s>='a')&&(s<='f')tmp = s-'a'+10;
-
 
799
		else if(s>='0')&&(s<='9')tmp = s-'0';
-
 
800
		text++;
-
 
801
		s = DSBYTE[text];
756
	}*/
802
	}
757
	return ret;
803
	return ret;
Line 758... Line 804...
758
}
804
}
759
 
805
 
Line 839... Line 885...
839
	END_FUNC_SPRINTF:
885
	END_FUNC_SPRINTF:
840
	DSBYTE[buf] = 0;
886
	DSBYTE[buf] = 0;
841
	return buf-ret;
887
	return buf-ret;
842
}
888
}
Line -... Line 889...
-
 
889
 
-
 
890
inline signed strcoll(dword text1,text2)
-
 
891
{
-
 
892
	char s,ss;
-
 
893
	loop()
-
 
894
	{
-
 
895
		s = DSBYTE[text2];
-
 
896
		ss=strchr(text1,s);
-
 
897
		if(ss)return ss;
-
 
898
		text2++;
-
 
899
	}
-
 
900
	return 0;
-
 
901
}
843
 
902
 
844
inline void debugi(dword d_int)
903
inline void debugi(dword d_int)
845
{
904
{
846
    char tmpch[12];
905
    char tmpch[12];
847
    itoa_(#tmpch, d_int);
906
    itoa_(#tmpch, d_int);
Line 852... Line 911...
852
//#define strncpy strcpyn
911
//#define strncpy strcpyn
853
#define strnmov strmovn
912
#define strnmov strmovn
854
#define stricmp strcmpi
913
#define stricmp strcmpi
855
#define strcmpn strncmp
914
#define strcmpn strncmp
Line -... Line 915...
-
 
915
 
856
>
916
#endif