/programs/develop/ktcc/trunk/libc/string/memmove.asm |
---|
0,0 → 1,35 |
format ELF |
section '.text' executable |
include 'proc32.inc' |
public memcpy |
public memmove |
proc memcpy stdcall, to:dword,from:dword,count:dword |
mov ecx,[count] |
test ecx,ecx |
jz no_copy_block |
mov esi,[from] |
mov edi,[to] |
rep movsb |
no_copy_block: |
ret |
endp |
proc memmove stdcall, to:dword,from:dword,count:dword |
mov ecx,[count] |
test ecx,ecx |
jz no_copy_block_ |
mov esi,[from] |
mov edi,[to] |
rep movsb |
no_copy_block_: |
ret |
endp |
/programs/develop/ktcc/trunk/libc/string/is.c |
---|
0,0 → 1,19 |
#include "ctype.h" |
int __is[128] = { |
0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, |
0x004, 0x104, 0x104, 0x104, 0x104, 0x104, 0x004, 0x004, |
0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, |
0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, 0x004, |
0x140, 0x0D0, 0x0D0, 0x0D0, 0x0D0, 0x0D0, 0x0D0, 0x0D0, |
0x0D0, 0x0D0, 0x0D0, 0x0D0, 0x0D0, 0x0D0, 0x0D0, 0x0D0, |
0x459, 0x459, 0x459, 0x459, 0x459, 0x459, 0x459, 0x459, |
0x459, 0x459, 0x0D0, 0x0D0, 0x0D0, 0x0D0, 0x0D0, 0x0D0, |
0x0D0, 0x653, 0x653, 0x653, 0x653, 0x653, 0x653, 0x253, |
0x253, 0x253, 0x253, 0x253, 0x253, 0x253, 0x253, 0x253, |
0x253, 0x253, 0x253, 0x253, 0x253, 0x253, 0x253, 0x253, |
0x253, 0x253, 0x253, 0x0D0, 0x0D0, 0x0D0, 0x0D0, 0x0D0, |
0x0D0, 0x473, 0x473, 0x473, 0x473, 0x473, 0x473, 0x073, |
0x073, 0x073, 0x073, 0x073, 0x073, 0x073, 0x073, 0x073, |
0x073, 0x073, 0x073, 0x073, 0x073, 0x073, 0x073, 0x073, |
0x073, 0x073, 0x073, 0x0D0, 0x0D0, 0x0D0, 0x0D0, 0x004 |
}; |
/programs/develop/ktcc/trunk/libc/string/strlen.c |
---|
0,0 → 1,7 |
int strlen(const char* string) |
{ |
int i; |
i=0; |
while (*string++) i++; |
return i; |
} |
/programs/develop/ktcc/trunk/libc/string/strcat.c |
---|
0,0 → 1,8 |
char* strcat(char* strDest, const char* strSource) |
{ |
char* res; |
res=strDest; |
while (*strDest++) ; |
while (*strDest++ = *strSource++) ; |
return res; |
} |
/programs/develop/ktcc/trunk/libc/string/strchr.c |
---|
0,0 → 1,10 |
char* strchr(const char* string, int c) |
{ |
while (*string) |
{ |
if (*string==c) |
return (char*)string; |
string++; |
} |
return (char*)0; |
} |
/programs/develop/ktcc/trunk/libc/string/strcpy.c |
---|
0,0 → 1,7 |
char* strcpy(char* strDest,char* strSource) |
{ |
char* res; |
res=strDest; |
while(*strDest++ == strSource++) ; |
return res; |
} |
/programs/develop/ktcc/trunk/libc/string/strncat.c |
---|
0,0 → 1,13 |
char* strncat(char* strDest,const char* strSource,int count) |
{ |
char* res; |
res=strDest; |
while (*strDest++) ; |
while(count-->0) |
{ |
if(*strDest++ = *strSource++) continue; |
return(res); |
} |
*strDest = 0; |
return res; |
} |
/programs/develop/ktcc/trunk/libc/string/strncmp.c |
---|
0,0 → 1,12 |
int strncmp(const char* string1, const char* string2, int count) |
{ |
while(count>0 && *string1==*string2) |
{ |
if (*string1) return 0; |
++string1; |
++string2; |
--count; |
} |
if(count) return (*string1 - *string2); |
return 0; |
} |
/programs/develop/ktcc/trunk/libc/string/strncpy.c |
---|
0,0 → 1,14 |
char* strncpy(char* strDest,const char* strSource,int count) |
{ |
char* res; |
res=strDest; |
while (count>0) |
{ |
*strDest=*strSource; |
if (*strSource!='\0') |
strSource++; |
strDest++; |
count--; |
} |
return res; |
} |
/programs/develop/ktcc/trunk/libc/string/memchr.c |
---|
0,0 → 1,10 |
void* memchr(const void* buf,int c,int count) |
{ |
int i; |
for (i=0;i<count;i++) |
if (*(char*)buf==c) |
return (void*)buf; |
else |
buf++; |
return (void*)0; |
} |
/programs/develop/ktcc/trunk/libc/string/memcmp.c |
---|
0,0 → 1,13 |
typedef unsigned char uc; |
int memcmp(const void* buf1,const void* buf2,int count) |
{ |
int i; |
for (i=0;i<count;i++) |
{ |
if (*(uc*)buf1<*(uc*)buf2) |
return -1; |
if (*(uc*)buf1>*(uc*)buf2) |
return 1; |
} |
return 0; |
} |
/programs/develop/ktcc/trunk/libc/string/memset.asm |
---|
0,0 → 1,15 |
format ELF |
section '.text' executable |
public memset |
memset: |
push edi |
mov edi,[esp+8] |
mov eax,[esp+12] |
mov ecx,[esp+16] |
jecxz .no_set |
cld |
rep stosb |
.no_set: |
pop edi |
ret |
/programs/develop/ktcc/trunk/libc/string/strcmp.c |
---|
0,0 → 1,14 |
int strcmp(const char* string1, const char* string2) |
{ |
while (1) |
{ |
if (*string1<*string2) |
return -1; |
if (*string1>*string2) |
return 1; |
if (*string1=='\0') |
return 0; |
string1++; |
string2++; |
} |
} |
/programs/develop/ktcc/trunk/libc/string/strcoll.c |
---|
0,0 → 1,4 |
int strcoll(const char* string1,const char* string2) |
{ |
return strcmp(string1,string2); |
} |
/programs/develop/ktcc/trunk/libc/string/strcspn.c |
---|
0,0 → 1,17 |
int strcspn(const char* string, const char* strCharSet) |
{ |
const char* temp; |
int i; |
i=0; |
while(1) |
{ |
temp=strCharSet; |
while (*temp!='\0') |
{ |
if (*string==*temp) |
return i; |
temp++; |
} |
i++;string++; |
} |
} |
/programs/develop/ktcc/trunk/libc/string/strdup.c |
---|
0,0 → 1,9 |
char* strdup(char* str) |
{ |
char* res; |
int len; |
len=strlen(str)+1; |
res=malloc(len); |
memcpy(res,str,len); |
return res; |
} |
/programs/develop/ktcc/trunk/libc/string/strerror.c |
---|
0,0 → 1,4 |
char* strerror(int err) |
{ |
return (char*)0; |
} |
/programs/develop/ktcc/trunk/libc/string/strnbrk.c |
---|
0,0 → 1,16 |
char* strpbrk(const char* string, const char* strCharSet) |
{ |
char* temp; |
while (*string!='\0') |
{ |
temp=strCharSet; |
while (*temp!='\0') |
{ |
if (*string==*temp) |
return string; |
temp++; |
} |
string++; |
} |
return (char*)0; |
} |
/programs/develop/ktcc/trunk/libc/string/strrchr.c |
---|
0,0 → 1,14 |
char* strrchr(const char* s,int c) |
{ |
char* res; |
res=(char*)0; |
while (1) |
{ |
if (*s==(char)c) |
res=(char*)s; |
if (*s=='\0') |
break; |
s++; |
} |
return res; |
} |
/programs/develop/ktcc/trunk/libc/string/strspn.c |
---|
0,0 → 1,20 |
int strspn(const char* string,const char* strCharSet) |
{ |
int i; |
const char* temp; |
i=0; |
while (*string!='\0') |
{ |
temp=strCharSet; |
while (temp!='\0') |
{ |
if (*temp==*string) |
break; |
} |
if (temp=='\0') |
break; |
*string++; |
i++; |
} |
return i; |
} |
/programs/develop/ktcc/trunk/libc/string/strstr.c |
---|
0,0 → 1,13 |
extern int strncmp(char* s1,char* s2,int len); |
char* strstr(const char* s, const char* find) |
{ |
int len; |
len=strlen(find); |
while (1) |
{ |
if (strncmp(s,find,len)==0) return s; |
if (*s=='\0') |
return (char*) 0; |
s++; |
} |
} |
/programs/develop/ktcc/trunk/libc/string/strtok.c |
---|
0,0 → 1,14 |
#include "string.h" |
char* strtok(char* s,const char* delim) |
{ |
char* res; |
if (*s=='\0') |
return (char*)0; |
s+=strspn(s,delim); |
if (*s=='\0') |
return (char*)0; |
res=s; |
s+=strcspn(s,delim); |
*s=='\0'; |
return res; |
} |
/programs/develop/ktcc/trunk/libc/string/strxfrm.c |
---|
0,0 → 1,4 |
int strxfrm(char* strDest, const char* strSource, int count) |
{ |
return 0; |
} |
/programs/develop/ktcc/trunk/libc/string/. |
---|
Property changes: |
Added: svn:ignore |
+*.o |
+*.s |