Added more crt functions and fixed some.

svn path=/trunk/; revision=607
This commit is contained in:
Eric Kohl 1999-07-29 21:25:04 +00:00
parent 69dc48c09f
commit e7cf9302fa
23 changed files with 1081 additions and 148 deletions

View file

@ -66,7 +66,7 @@ GetEnvironmentVariableW(
while (i < nEnvVar) while (i < nEnvVar)
{ {
if ( wcsnicmp(Environment[i].Name.Buffer,lpName,min(NameLen,Environment[i].Name.Length/sizeof(WCHAR))) != 0 ) { if ( _wcsnicmp(Environment[i].Name.Buffer,lpName,min(NameLen,Environment[i].Name.Length/sizeof(WCHAR))) != 0 ) {
lstrcpynW(lpBuffer,Environment[i].Value.Buffer,min(nSize,Environment[i].Value.Length/sizeof(WCHAR))); lstrcpynW(lpBuffer,Environment[i].Value.Buffer,min(nSize,Environment[i].Value.Length/sizeof(WCHAR)));
return lstrlenW(Environment[i].Value.Buffer); return lstrlenW(Environment[i].Value.Buffer);
@ -130,7 +130,7 @@ SetEnvironmentVariableW(
while (i < nEnvVar) while (i < nEnvVar)
{ {
if ( wcsnicmp(Environment[i].Name.Buffer,lpName,min(NameLen,Environment[i].Name.Length/sizeof(WCHAR))) != 0 ) { if ( _wcsnicmp(Environment[i].Name.Buffer,lpName,min(NameLen,Environment[i].Name.Length/sizeof(WCHAR))) != 0 ) {
if ( lpValue != NULL ) { if ( lpValue != NULL ) {
lstrcpynW(Environment[i].Value.Buffer,lpValue,min(ValueLen,Environment[i].Value.MaximumLength/sizeof(WCHAR))); lstrcpynW(Environment[i].Value.Buffer,lpValue,min(ValueLen,Environment[i].Value.MaximumLength/sizeof(WCHAR)));
return TRUE; return TRUE;

View file

@ -89,8 +89,7 @@ lstrcmpiW(
LPCWSTR lpString2 LPCWSTR lpString2
) )
{ {
return wcsicmp(lpString1,lpString2); return _wcsicmp(lpString1,lpString2);
} }
LPWSTR LPWSTR
@ -135,8 +134,3 @@ lstrlenW(
} }

View file

@ -421,34 +421,59 @@ ZwWriteVirtualMemory@20
ZwW32Call@20 ZwW32Call@20
ZwYieldExecution@0 ZwYieldExecution@0
RtlAllocateHeap@12 RtlAllocateHeap@12
RtlAnsiStringToUnicodeSize
RtlAnsiStringToUnicodeString
RtlAppendUnicodeStringToString
RtlAppendUnicodeToString
RtlCharToInteger
RtlCreateHeap@24 RtlCreateHeap@24
RtlCompactHeap@8 RtlCompactHeap@8
RtlCompareString
RtlCompareUnicodeString
RtlCopyString
RtlCopyUnicodeString
RtlDestroyHeap@4 RtlDestroyHeap@4
RtlFreeHeap@12
RtlGetProcessHeap@0
RtlLockHeap@4
RtlReAllocHeap@16
RtlSizeHeap@12
RtlUnlockHeap@4
RtlValidateHeap@12
RtlAnsiStringToUnicodeString
RtlEnlargedIntegerMultiply RtlEnlargedIntegerMultiply
RtlEnlargedUnsignedMultiply RtlEnlargedUnsignedMultiply
RtlEqualString
RtlEqualUnicodeString
RtlExtendedIntegerMultiply RtlExtendedIntegerMultiply
RtlFreeAnsiString RtlFreeAnsiString
RtlFreeHeap@12
RtlFreeUnicodeString RtlFreeUnicodeString
RtlGetProcessHeap@0
RtlInitAnsiString RtlInitAnsiString
RtlInitString
RtlInitUnicodeString RtlInitUnicodeString
RtlIntegerToUnicodeString
RtlLargeIntegerAdd RtlLargeIntegerAdd
RtlLargeIntegerDivide RtlLargeIntegerDivide
RtlLengthSecurityDescriptor RtlLengthSecurityDescriptor
RtlLockHeap@4
RtlNtStatusToDosError RtlNtStatusToDosError
RtlReAllocHeap@16
RtlSizeHeap@12
RtlUnlockHeap@4
RtlUnicodeStringToAnsiSize
RtlUnicodeStringToAnsiString
RtlUnicodeStringToInteger
RtlUpcaseString
RtlUpcaseUnicodeString
RtlValidateHeap@12
_memccpy
_memicmp
_splitpath _splitpath
_strcmpi _strcmpi
_stricmp _stricmp
_strlwr _strlwr
_strnicmp _strnicmp
_strupr _strupr
_tolower
_toupper
_wcsicmp
_wcslwr
_wcsnicmp
_wcsupr
atoi atoi
atol atol
isalpha isalpha
@ -456,11 +481,14 @@ isalnum
iscntrl iscntrl
isdigit isdigit
isgraph isgraph
islower
isprint isprint
ispunct ispunct
isspace isspace
isupper isupper
iswlower isxdigit
memchr
memcmp
memcpy memcpy
memmove memmove
memset memset
@ -470,25 +498,32 @@ strchr
strcmp strcmp
strcpy strcpy
strcspn strcspn
strlen
strncat strncat
strncmp strncmp
strncpy strncpy
strlen strpbrk
strrchr strrchr
strspn
strstr strstr
strtol strtol
strtoul strtoul
tolower tolower
toupper toupper
towlower
towupper towupper
vsprintf
wcscat wcscat
wcschr wcschr
wcscmp wcscmp
wcscpy wcscpy
wcsncpy wcscspn
wcslen wcslen
wcsncat
wcsncmp
wcsncpy
wcspbrk
wcsrchr wcsrchr
wcsicmp wcsspn
wcsnicmp wcsstr
vsprintf
LdrMapNTDllForProcess LdrMapNTDllForProcess

View file

@ -421,34 +421,59 @@ ZwWriteVirtualMemory=ZwWriteVirtualMemory@20
ZwW32Call=ZwW32Call@20 ZwW32Call=ZwW32Call@20
ZwYieldExecution=ZwYieldExecution@0 ZwYieldExecution=ZwYieldExecution@0
RtlAllocateHeap=RtlAllocateHeap@12 RtlAllocateHeap=RtlAllocateHeap@12
RtlAnsiStringToUnicodeSize
RtlAnsiStringToUnicodeString
RtlAppendUnicodeStringToString
RtlAppendUnicodeToString
RtlCharToInteger
RtlCreateHeap=RtlCreateHeap@24 RtlCreateHeap=RtlCreateHeap@24
RtlCompactHeap=RtlCompactHeap@8 RtlCompactHeap=RtlCompactHeap@8
RtlCompareString
RtlCompareUnicodeString
RtlCopyString
RtlCopyUnicodeString
RtlDestroyHeap=RtlDestroyHeap@4 RtlDestroyHeap=RtlDestroyHeap@4
RtlFreeHeap=RtlFreeHeap@12
RtlGetProcessHeap=RtlGetProcessHeap@0
RtlLockHeap=RtlLockHeap@4
RtlReAllocHeap=RtlReAllocHeap@16
RtlSizeHeap=RtlSizeHeap@12
RtlUnlockHeap=RtlUnlockHeap@4
RtlValidateHeap=RtlValidateHeap@12
RtlAnsiStringToUnicodeString
RtlEnlargedIntegerMultiply RtlEnlargedIntegerMultiply
RtlEnlargedUnsignedMultiply RtlEnlargedUnsignedMultiply
RtlEqualString
RtlEqualUnicodeString
RtlExtendedIntegerMultiply RtlExtendedIntegerMultiply
RtlFreeAnsiString RtlFreeAnsiString
RtlFreeHeap=RtlFreeHeap@12
RtlFreeUnicodeString RtlFreeUnicodeString
RtlGetProcessHeap=RtlGetProcessHeap@0
RtlInitAnsiString RtlInitAnsiString
RtlInitString
RtlInitUnicodeString RtlInitUnicodeString
RtlIntegerToUnicodeString
RtlLargeIntegerAdd RtlLargeIntegerAdd
RtlLargeIntegerDivide RtlLargeIntegerDivide
RtlLengthSecurityDescriptor RtlLengthSecurityDescriptor
RtlLockHeap=RtlLockHeap@4
RtlNtStatusToDosError RtlNtStatusToDosError
RtlReAllocHeap=RtlReAllocHeap@16
RtlSizeHeap=RtlSizeHeap@12
RtlUnlockHeap=RtlUnlockHeap@4
RtlUnicodeStringToAnsiSize
RtlUnicodeStringToAnsiString
RtlUnicodeStringToInteger
RtlUpcaseString
RtlUpcaseUnicodeString
RtlValidateHeap=RtlValidateHeap@12
_memccpy
_memicmp
_splitpath _splitpath
_strcmpi _strcmpi
_stricmp _stricmp
_strlwr _strlwr
_strnicmp _strnicmp
_strupr _strupr
_tolower
_toupper
_wcsicmp
_wcslwr
_wcsnicmp
_wcsupr
atoi atoi
atol atol
isalpha isalpha
@ -456,11 +481,14 @@ isalnum
iscntrl iscntrl
isdigit isdigit
isgraph isgraph
islower
isprint isprint
ispunct ispunct
isspace isspace
isupper isupper
iswlower isxdigit
memchr
memcmp
memcpy memcpy
memmove memmove
memset memset
@ -470,25 +498,32 @@ strchr
strcmp strcmp
strcpy strcpy
strcspn strcspn
strlen
strncat strncat
strncmp strncmp
strncpy strncpy
strlen strpbrk
strrchr strrchr
strspn
strstr strstr
strtol strtol
strtoul strtoul
tolower tolower
toupper toupper
towlower
towupper towupper
vsprintf
wcscat wcscat
wcschr wcschr
wcscmp wcscmp
wcscpy wcscpy
wcsncpy wcscspn
wcslen wcslen
wcsncat
wcsncmp
wcsncpy
wcspbrk
wcsrchr wcsrchr
wcsicmp wcsspn
wcsnicmp wcsstr
vsprintf
LdrMapNTDllForProcess LdrMapNTDllForProcess

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.20 1999/07/22 21:31:39 ekohl Exp $ # $Id: makefile,v 1.21 1999/07/29 21:14:02 ekohl Exp $
# #
# ReactOS Operating System # ReactOS Operating System
# #
@ -27,12 +27,14 @@ RTL_OBJECTS = rtl/critical.o rtl/error.o rtl/heap.o rtl/largeint.o \
STDLIB_OBJECTS = stdlib/atoi.o stdlib/atol.o stdlib/splitp.o \ STDLIB_OBJECTS = stdlib/atoi.o stdlib/atol.o stdlib/splitp.o \
stdlib/strtol.o stdlib/strtoul.o stdlib/strtol.o stdlib/strtoul.o
STRING_OBJECTS = string/ctype.o string/memcpy.o string/memmove.o \ STRING_OBJECTS = string/ctype.o string/memccpy.o string/memchr.o \
string/memset.o string/strcat.o string/strchr.o \ string/memcmp.o string/memcpy.o string/memicmp.o\
string/strcmp.o string/strcspn.o \ string/memmove.o string/memset.o string/strcat.o \
string/strcpy.o string/stricmp.o string/strlen.o string/strlwr.o \ string/strchr.o string/strcmp.o string/strcspn.o \
string/strncat.o string/strncmp.o string/strncpy.o \ string/strcpy.o string/stricmp.o string/strlen.o \
string/strnicmp.o string/strnlen.o string/strrchr.o \ string/strlwr.o string/strncat.o string/strncmp.o \
string/strncpy.o string/strnicmp.o string/strnlen.o \
string/strpbrk.o string/strrchr.o string/strspn.o \
string/strstr.o string/strupr.o string/wstring.o string/strstr.o string/strupr.o string/wstring.o
OBJECTS = napi.o ldr/startup.o $(RTL_OBJECTS) \ OBJECTS = napi.o ldr/startup.o $(RTL_OBJECTS) \

View file

@ -404,6 +404,13 @@ NTSTATUS RtlIntegerToUnicodeString(IN ULONG Value, IN ULONG Base,
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
ULONG RtlUnicodeStringToAnsiSize(IN PUNICODE_STRING UnicodeString)
{
return UnicodeString->Length/2;
}
NTSTATUS RtlUnicodeStringToAnsiString(IN OUT PANSI_STRING DestinationString, NTSTATUS RtlUnicodeStringToAnsiString(IN OUT PANSI_STRING DestinationString,
IN PUNICODE_STRING SourceString, IN PUNICODE_STRING SourceString,
IN BOOLEAN AllocateDestinationString) IN BOOLEAN AllocateDestinationString)
@ -430,7 +437,8 @@ NTSTATUS RtlUnicodeStringToAnsiString(IN OUT PANSI_STRING DestinationString,
SourceString->Buffer-=SourceString->Length; SourceString->Buffer-=SourceString->Length;
return STATUS_SUCCESS; return STATUS_SUCCESS;
}; }
NTSTATUS RtlUnicodeStringToInteger(IN PUNICODE_STRING String, IN ULONG Base, NTSTATUS RtlUnicodeStringToInteger(IN PUNICODE_STRING String, IN ULONG Base,
OUT PULONG Value) OUT PULONG Value)

View file

@ -383,19 +383,12 @@ int wsprintfW(unsigned short * buf, const unsigned short *fmt, ...)
} }
#endif #endif
unsigned short towupper(unsigned short w) #if 0
{
if ( w < L'A' )
return w + 'A';
else
return w;
}
int iswlower(wint_t w) int iswlower(wint_t w)
{ {
if ( w < L'A' ) if ( w < L'A' )
return 1; return 1;
else else
return 0; return 0;
} }
#endif

View file

@ -1,73 +1,101 @@
#include <ctype.h>
#define upalpha ('A' - 'a') #define upalpha ('A' - 'a')
int isalpha(char c) int isalpha(int c)
{ {
return(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z'))); return(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')));
} }
int isalnum(char c) int isalnum(int c)
{ {
return(isalpha(c)||isdigit(c)); return(isalpha(c)||isdigit(c));
} }
int iscntrl(char c) int iscntrl(int c)
{ {
return((c >=0x00 && c <= 0x1f) || c == 0x7f); return((c >=0x00 && c <= 0x1f) || c == 0x7f);
} }
int isdigit(char c) int isdigit(int c)
{ {
return((c>='0') && (c<='9')); return((c>='0') && (c<='9'));
} }
int isgraph(char c) int isgraph(int c)
{ {
return(c>=0x21 && c<=0x7e); return(c>=0x21 && c<=0x7e);
} }
int islower(char c) int islower(int c)
{ {
return((c>='a') && (c<='z')); return((c>='a') && (c<='z'));
} }
int isprint(char c) int isprint(int c)
{ {
return(c>=0x20 && c<=0x7e); return(c>=0x20 && c<=0x7e);
} }
int ispunct(char c) int ispunct(int c)
{ {
return((c>=0x21 && c<=0x2f)||(c>=0x3a && c<=0x40)||(c>=0x5b && c<=0x60)); return((c>=0x21 && c<=0x2f)||(c>=0x3a && c<=0x40)||(c>=0x5b && c<=0x60));
} }
int isspace(char c) int isspace(int c)
{ {
return(c==' '||c=='\t'); return(c==' '||c=='\t');
} }
int isupper(char c) int isupper(int c)
{ {
return((c>='A') && (c<='Z')); return((c>='A') && (c<='Z'));
} }
int isxdigit(char c) int isxdigit(int c)
{ {
return(((c>='0') && (c<='9')) || ((toupper(c)>='A') && (toupper(c)<='Z'))); return(((c>='0') && (c<='9')) || ((toupper(c)>='A') && (toupper(c)<='Z')));
} }
int _tolower(int c)
char tolower(char c)
{ {
if (c>='A' && c <= 'Z') if (c>='A' && c <= 'Z')
return (c - upalpha); return (c - upalpha);
return(c); return(c);
} }
char toupper(char c) int _toupper(int c)
{ {
if ((c>='a') && (c<='z')) if ((c>='a') && (c<='z'))
return (c+upalpha); return (c+upalpha);
return(c); return(c);
} }
int tolower(int c)
{
if (c>='A' && c <= 'Z')
return (c - upalpha);
return(c);
}
int toupper(int c)
{
if ((c>='a') && (c<='z'))
return (c+upalpha);
return(c);
}
wchar_t towlower(wchar_t c)
{
if (c>='A' && c <= 'Z')
return (c - upalpha);
return(c);
}
wchar_t towupper(wchar_t c)
{
if ((c>='a') && (c<='z'))
return (c+upalpha);
return(c);
}

View file

@ -0,0 +1,9 @@
#include <string.h>
void *
_memccpy (void *to, const void *from,int c,size_t count)
{
memcpy(to,from,count);
return memchr(to,c,count);
}

View file

@ -0,0 +1,18 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <crtdll/string.h>
void *
memchr(const void *s, int c, size_t n)
{
if (n)
{
const char *p = s;
do {
if (*p++ == c)
return (void *)(p-1);
} while (--n != 0);
}
return 0;
}

View file

@ -0,0 +1,17 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
int
memcmp(const void *s1, const void *s2, size_t n)
{
if (n != 0)
{
const unsigned char *p1 = s1, *p2 = s2;
do {
if (*p1++ != *p2++)
return (*--p1 - *--p2);
} while (--n != 0);
}
return 0;
}

View file

@ -0,0 +1,20 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
#include <ctype.h>
int
_memicmp(const void *s1, const void *s2, size_t n)
{
if (n != 0)
{
const unsigned char *p1 = s1, *p2 = s2;
do {
if (toupper(*p1) != toupper(*p2))
return (*p1 - *p2);
p1++;
p2++;
} while (--n != 0);
}
return 0;
}

View file

@ -0,0 +1,18 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
char *
strpbrk(const char *s1, const char *s2)
{
const char *scanp;
int c, sc;
while ((c = *s1++) != 0)
{
for (scanp = s2; (sc = *scanp++) != 0;)
if (sc == c)
return (char *)(s1 - 1);
}
return 0;
}

View file

@ -0,0 +1,16 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <string.h>
size_t
strspn(const char *s1, const char *s2)
{
const char *p = s1, *spanp;
char c, sc;
cont:
c = *p++;
for (spanp = s2; (sc = *spanp++) != 0;)
if (sc == c)
goto cont;
return (p - 1 - s1);
}

View file

@ -20,14 +20,56 @@
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
int wcsnicmp(const wchar_t* ws1, const wchar_t* ws2, size_t size) int _wcsicmp(const wchar_t* cs,const wchar_t * ct)
{ {
while (towlower(*cs) == towlower(*ct))
{
if (*cs == 0)
return 0;
cs++;
ct++;
}
return towlower(*cs) - towlower(*ct);
} }
int wcsicmp(const wchar_t* ws1, const wchar_t* ws2)
wchar_t* _wcslwr(wchar_t *x)
{ {
wchar_t *y=x;
while (*y) {
*y=towlower(*y);
y++;
}
return x;
} }
int _wcsnicmp(const wchar_t * cs,const wchar_t * ct,size_t count)
{
wchar_t *save = (wchar_t *)cs;
while (towlower(*cs) == towlower(*ct) && (int)(cs - save) < count)
{
if (*cs == 0)
return 0;
cs++;
ct++;
}
return towlower(*cs) - towlower(*ct);
}
wchar_t *_wcsupr(wchar_t *x)
{
wchar_t *y=x;
while (*y) {
*y=towupper(*y);
y++;
}
return x;
}
wchar_t* wcscat(wchar_t *dest, const wchar_t *src) wchar_t* wcscat(wchar_t *dest, const wchar_t *src)
{ {
int i, j; int i, j;
@ -81,6 +123,26 @@ wchar_t* wcscpy(wchar_t* str1, const wchar_t* str2)
} }
size_t wcscspn(const wchar_t *str,const wchar_t *reject)
{
wchar_t *s;
wchar_t *t;
s=(wchar_t *)str;
do {
t=(wchar_t *)reject;
while (*t) {
if (*t==*s)
break;
t++;
}
if (*t)
break;
s++;
} while (*s);
return s-str; /* nr of wchars */
}
size_t wcslen(const wchar_t *s) size_t wcslen(const wchar_t *s)
{ {
unsigned int len = 0; unsigned int len = 0;
@ -114,6 +176,19 @@ wcsncat(wchar_t *dest, const wchar_t *src, size_t count)
} }
int wcsncmp(const wchar_t * cs,const wchar_t * ct,size_t count)
{
while ((*cs) == (*ct) && count > 0)
{
if (*cs == 0)
return 0;
cs++;
ct++;
count--;
}
return (*cs) - (*ct);
}
wchar_t* wcsncpy(wchar_t *dest, const wchar_t *src, size_t count) wchar_t* wcsncpy(wchar_t *dest, const wchar_t *src, size_t count)
{ {
@ -133,8 +208,24 @@ wchar_t* wcsncpy(wchar_t *dest, const wchar_t *src, size_t count)
} }
wchar_t * wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2)
wcsrchr(const wchar_t *str, wchar_t ch) {
const wchar_t *scanp;
int c, sc;
while ((c = *s1++) != 0)
{
for (scanp = s2; (sc = *scanp++) != 0;)
if (sc == c)
{
return (wchar_t *)(--s1);
}
}
return 0;
}
wchar_t * wcsrchr(const wchar_t *str, wchar_t ch)
{ {
unsigned int len = 0; unsigned int len = 0;
while (str[len] != ((wchar_t)0)) while (str[len] != ((wchar_t)0))
@ -154,4 +245,44 @@ wcsrchr(const wchar_t *str, wchar_t ch)
} }
size_t wcsspn(const wchar_t *str,const wchar_t *accept)
{
wchar_t *s;
wchar_t *t;
s=(wchar_t *)str;
do {
t=(wchar_t *)accept;
while (*t) {
if (*t==*s)
break;
t++;
}
if (!*t)
break;
s++;
} while (*s);
return s-str; /* nr of wchars */
}
wchar_t *wcsstr(const wchar_t *s,const wchar_t *b)
{
wchar_t *x;
wchar_t *y;
wchar_t *c;
x=(wchar_t *)s;
while (*x) {
if (*x==*b) {
y=x;
c=(wchar_t *)b;
while (*y && *c && *y==*c) {
c++;
y++;
}
if (!*c)
return x;
}
x++;
}
return NULL;
}

View file

@ -213,20 +213,11 @@ STUB(_itoa)
STUB(_itow) STUB(_itow)
STUB(_ltoa) STUB(_ltoa)
STUB(_ltow) STUB(_ltow)
STUB(_memccpy)
STUB(_memicmp)
STUB(_snprintf) STUB(_snprintf)
STUB(_snwprintf) STUB(_snwprintf)
//STUB(_strlwr)
STUB(_tolower)
STUB(_toupper)
STUB(_ultoa) STUB(_ultoa)
STUB(_ultow) STUB(_ultow)
STUB(_vsnprintf) STUB(_vsnprintf)
STUB(_wcsicmp)
STUB(_wcslwr)
STUB(_wcsnicmp)
STUB(_wcsupr)
STUB(_wtoi) STUB(_wtoi)
STUB(_wtoi64) STUB(_wtoi64)
STUB(_wtol) STUB(_wtol)
@ -241,15 +232,11 @@ STUB(iswctype)
STUB(labs) STUB(labs)
STUB(log) STUB(log)
STUB(mbstowcs) STUB(mbstowcs)
STUB(memchr)
STUB(memcmp)
STUB(pow) STUB(pow)
STUB(qsort) STUB(qsort)
STUB(sin) STUB(sin)
STUB(sqrt) STUB(sqrt)
STUB(sscanf) STUB(sscanf)
STUB(strpbrk)
STUB(strspn)
STUB(swprintf) STUB(swprintf)
STUB(tan) STUB(tan)

View file

@ -1,4 +1,4 @@
# $Id: makefile_rex,v 1.28 1999/07/17 23:10:25 ea Exp $ # $Id: makefile_rex,v 1.29 1999/07/29 21:25:04 ekohl Exp $
# #
# ReactOS Operating System # ReactOS Operating System
# #
@ -15,11 +15,11 @@ NT_OBJECTS = nt/port.o nt/channel.o nt/ntevent.o nt/nttimer.o nt/atom.o \
nt/evtpair.o nt/ntsem.o nt/mutant.o nt/misc.o nt/plugplay.o \ nt/evtpair.o nt/ntsem.o nt/mutant.o nt/misc.o nt/plugplay.o \
nt/profile.o nt/nt.o nt/zw.o nt/profile.o nt/nt.o nt/zw.o
RTL_OBJECTS = rtl/vsprintf.o rtl/lookas.o rtl/unicode.o rtl/strtok.o \ RTL_OBJECTS = rtl/vsprintf.o rtl/lookas.o rtl/unicode.o rtl/time.o \
rtl/time.o rtl/unalign.o rtl/mem.o rtl/largeint.o rtl/ctype.o \ rtl/unalign.o rtl/mem.o rtl/largeint.o rtl/ctype.o \
rtl/list.o rtl/slist.o rtl/interlck.o rtl/return.o \ rtl/list.o rtl/slist.o rtl/interlck.o rtl/return.o \
rtl/wstring.o rtl/memcpy.o rtl/memmove.o rtl/memset.o \ rtl/wstring.o rtl/memcpy.o rtl/memmove.o rtl/memset.o \
rtl/memchr.o rtl/memchr.o rtl/string.o rtl/stdlib.o
KE_OBJECTS = ke/main.o ke/timer.o ke/error.o ke/catch.o \ KE_OBJECTS = ke/main.o ke/timer.o ke/error.o ke/catch.o \
ke/dpc.o ke/wait.o ke/kqueue.o ke/dispatch.o \ ke/dpc.o ke/wait.o ke/kqueue.o ke/dispatch.o \

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.13 1999/07/17 23:10:26 ea Exp $ ; $Id: ntoskrnl.def,v 1.14 1999/07/29 21:25:04 ekohl Exp $
; ;
; reactos/ntoskrnl/ntoskrnl.def ; reactos/ntoskrnl/ntoskrnl.def
; ;
@ -87,6 +87,7 @@ KeInitializeEvent
KeInitializeSpinLock KeInitializeSpinLock
KeInsertQueueDpc KeInsertQueueDpc
KeLowerIrql KeLowerIrql
KeQuerySystemTime
KeStallExecutionProcessor KeStallExecutionProcessor
KeSynchronizeExecution KeSynchronizeExecution
KeRaiseIrql KeRaiseIrql
@ -265,24 +266,83 @@ ZwWaitForMultipleObjects@20
ZwWaitForSingleObject@12 ZwWaitForSingleObject@12
ZwWriteFile@36 ZwWriteFile@36
ZwYieldExecution@0 ZwYieldExecution@0
;_abnormal_termination
;_alldiv
;_allmul
;_allrem
;_allshl
;_allshr
;_aulldiv
;_aullrem
;_aullshr
;_except_handler2
;_global_unwind2
;_itoa
;_local_unwind2
;_purecall
;_snprintf
;_snwprintf
_stricmp
_strlwr
_strnicmp
_strnset
_strrev
_strset
_strupr
;_vsnprintf
_wcsicmp
_wcslwr
_wcsnicmp
_wcsnset
_wcsrev
_wcsupr
;atoi
;atol
isdigit isdigit
islower islower
isprint isprint
isspace isspace
isupper isupper
isxdigit isxdigit
;mbstowcs
;mbtowc
memchr memchr
memcpy memcpy
memmove memmove
memset memset
strtok ;qsort
rand
sprintf
srand
strcat
strchr
strcmp
strcpy
strlen
strncat
strncmp
strcpy
strrchr
strspn
strstr
;strtok
;swprintf
tolower tolower
toupper toupper
towlower towlower
towupper towupper
vsprintf vsprintf
wcscat
wcschr wcschr
wcscmp
wcscpy wcscpy
wcscspn
wcslen wcslen
wcsncpy
wcsncat wcsncat
wcsncmp
wcsncpy
wcsrchr
wcsspn
wcsstr
;wcstombs
;wctomb

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.edf,v 1.1 1999/07/17 23:10:26 ea Exp $ ; $Id: ntoskrnl.edf,v 1.2 1999/07/29 21:25:04 ekohl Exp $
; ;
; reactos/ntoskrnl/ntoskrnl.def ; reactos/ntoskrnl/ntoskrnl.def
; ;
@ -87,6 +87,7 @@ KeInitializeEvent
KeInitializeSpinLock KeInitializeSpinLock
KeInsertQueueDpc KeInsertQueueDpc
KeLowerIrql KeLowerIrql
KeQuerySystemTime
KeStallExecutionProcessor KeStallExecutionProcessor
KeSynchronizeExecution KeSynchronizeExecution
KeRaiseIrql KeRaiseIrql
@ -265,24 +266,83 @@ ZwWaitForMultipleObjects=ZwWaitForMultipleObjects@20
ZwWaitForSingleObject=ZwWaitForSingleObject@12 ZwWaitForSingleObject=ZwWaitForSingleObject@12
ZwWriteFile=ZwWriteFile@36 ZwWriteFile=ZwWriteFile@36
ZwYieldExecution=ZwYieldExecution@0 ZwYieldExecution=ZwYieldExecution@0
;_abnormal_termination
;_alldiv
;_allmul
;_allrem
;_allshl
;_allshr
;_aulldiv
;_aullrem
;_aullshr
;_except_handler2
;_global_unwind2
;_itoa
;_local_unwind2
;_purecall
;_snprintf
;_snwprintf
_stricmp
_strlwr
_strnicmp
_strnset
_strrev
_strset
_strupr
;_vsnprintf
_wcsicmp
_wcslwr
_wcsnicmp
_wcsnset
_wcsrev
_wcsupr
;atoi
;atol
isdigit isdigit
islower islower
isprint isprint
isspace isspace
isupper isupper
isxdigit isxdigit
;mbstowcs
;mbtowc
memchr memchr
memcpy memcpy
memmove memmove
memset memset
strtok ;qsort
rand
sprintf
srand
strcat
strchr
strcmp
strcpy
strlen
strncat
strncmp
strcpy
strrchr
strspn
strstr
;strtok
;swprintf
tolower tolower
toupper toupper
towlower towlower
towupper towupper
vsprintf vsprintf
wcscat
wcschr wcschr
wcscmp
wcscpy wcscpy
wcscspn
wcslen wcslen
wcsncpy
wcsncat wcsncat
wcsncmp
wcsncpy
wcsrchr
wcsspn
wcsstr
;wcstombs
;wctomb

View file

@ -72,10 +72,10 @@ VOID ObAddEntryDirectory(PDIRECTORY_OBJECT Parent,
{ {
KIRQL oldlvl; KIRQL oldlvl;
POBJECT_HEADER Header = BODY_TO_HEADER(Object); POBJECT_HEADER Header = BODY_TO_HEADER(Object);
RtlInitUnicodeString(&Header->Name, wcsdup(Name)); RtlInitUnicodeString(&Header->Name, wcsdup(Name));
Header->Parent = Parent; Header->Parent = Parent;
KeAcquireSpinLock(&Parent->Lock, &oldlvl); KeAcquireSpinLock(&Parent->Lock, &oldlvl);
InsertTailList(&Parent->head, &Header->Entry); InsertTailList(&Parent->head, &Header->Entry);
KeReleaseSpinLock(&Parent->Lock, oldlvl); KeReleaseSpinLock(&Parent->Lock, oldlvl);
@ -108,7 +108,7 @@ PVOID ObpFindEntryDirectory(PDIRECTORY_OBJECT DirectoryObject,
DPRINT("Scanning %w %w\n",current_obj->Name.Buffer, Name); DPRINT("Scanning %w %w\n",current_obj->Name.Buffer, Name);
if (Attributes & OBJ_CASE_INSENSITIVE) if (Attributes & OBJ_CASE_INSENSITIVE)
{ {
if (wcsicmp(current_obj->Name.Buffer, Name)==0) if (_wcsicmp(current_obj->Name.Buffer, Name)==0)
{ {
DPRINT("Found it %x\n",HEADER_TO_BODY(current_obj)); DPRINT("Found it %x\n",HEADER_TO_BODY(current_obj));
return(HEADER_TO_BODY(current_obj)); return(HEADER_TO_BODY(current_obj));

View file

@ -0,0 +1,86 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/rtl/stdlib.c
* PURPOSE: Standard library functions
* PROGRAMMER: Eric Kohl (ekohl@abo.rhein-zeitung.de)
* UPDATE HISTORY:
* 1999/07/29 ekohl Created
*/
/* INCLUDES *****************************************************************/
#include <ctype.h>
#include <stdlib.h>
/* GLOBALS ****************************************************************/
static unsigned long long next = 0;
/* FUNCTIONS ****************************************************************/
#if 0
int atoi(const char *str)
{
return (int)strtol(str, 0, 10);
}
long atol(const char *str)
{
return strtol(str, 0, 10);
}
char *_itoa(int value, char *string, int radix)
{
char tmp[33];
char *tp = tmp;
int i;
unsigned v;
int sign;
char *sp;
if (string == 0)
return NULL;
if (radix > 36 || radix <= 1)
{
__set_errno(EDOM);
return 0;
}
sign = (radix == 10 && value < 0);
if (sign)
v = -value;
else
v = (unsigned)value;
while (v || tp == tmp)
{
i = v % radix;
v = v / radix;
if (i < 10)
*tp++ = i+'0';
else
*tp++ = i + 'a' - 10;
}
if (sign)
*sp++ = '-';
while (tp > tmp)
*sp++ = *--tp;
*sp = 0;
return string;
}
#endif
int rand(void)
{
next = next * 0x5deece66dLL + 11;
return (int)((next >> 16) & RAND_MAX);
}
void srand(unsigned seed)
{
next = seed;
}

View file

@ -0,0 +1,304 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/rtl/string.c
* PURPOSE: Ascii string functions
* PROGRAMMER: Eric Kohl (ekohl@abo.rhein-zeitung.de)
* UPDATE HISTORY:
* 1999/07/29 ekohl Created
*/
/* INCLUDES *****************************************************************/
#include <ctype.h>
#include <string.h>
/* FUNCTIONS *****************************************************************/
int _stricmp(const char *s1, const char *s2)
{
while (toupper(*s1) == toupper(*s2))
{
if (*s1 == 0)
return 0;
s1++;
s2++;
}
return toupper(*(unsigned const char *)s1) - toupper(*(unsigned const char *)(s2));
}
char * _strlwr(char *x)
{
char *y=x;
while (*y)
{
*y=tolower(*y);
y++;
}
return x;
}
int _strnicmp(const char *s1, const char *s2, size_t n)
{
if (n == 0)
return 0;
do
{
if (toupper(*s1) != toupper(*s2++))
return toupper(*(unsigned const char *)s1) - toupper(*(unsigned const char *)--s2);
if (*s1++ == 0)
break;
}
while (--n != 0);
return 0;
}
char* _strnset(char* szToFill, int szFill, size_t sizeMaxFill)
{
char *t = szToFill;
int i = 0;
while (*szToFill != 0 && i < sizeMaxFill)
{
*szToFill = szFill;
szToFill++;
i++;
}
return t;
}
char * _strrev(char *s)
{
char *e;
char a;
e = s;
while (*e)
e++;
while (s<e)
{
a = *s;
*s = *e;
*e = a;
s++;
e--;
}
return s;
}
char* _strset(char* szToFill, int szFill)
{
char *t = szToFill;
while (*szToFill != 0)
{
*szToFill = szFill;
szToFill++;
}
return t;
}
char *_strupr(char *x)
{
char *y=x;
while (*y)
{
*y=toupper(*y);
y++;
}
return x;
}
char *strcat(char *s, const char *append)
{
char *save = s;
for (; *s; ++s);
while ((*s++ = *append++));
return save;
}
char *strchr(const char *s, int c)
{
char cc = c;
while (*s)
{
if (*s == cc)
return (char *)s;
s++;
}
if (cc == 0)
return (char *)s;
return 0;
}
int strcmp(const char *s1, const char *s2)
{
while (*s1 == *s2)
{
if (*s1 == 0)
return 0;
s1++;
s2++;
}
return *(unsigned const char *)s1 - *(unsigned const char *)(s2);
}
char* strcpy(char *to, const char *from)
{
char *save = to;
for (; (*to = *from); ++from, ++to);
return save;
}
size_t strlen(const char *str)
{
const char *s;
if (str == 0)
return 0;
for (s = str; *s; ++s);
return s-str;
}
char *strncat(char *dst, const char *src, size_t n)
{
if (n != 0)
{
char *d = dst;
const char *s = src;
while (*d != 0)
d++;
do
{
if ((*d = *s++) == 0)
break;
d++;
}
while (--n != 0);
*d = 0;
}
return dst;
}
int strncmp(const char *s1, const char *s2, size_t n)
{
if (n == 0)
return 0;
do
{
if (*s1 != *s2++)
return *(unsigned const char *)s1 - *(unsigned const char *)--s2;
if (*s1++ == 0)
break;
}
while (--n != 0);
return 0;
}
char *strncpy(char *dst, const char *src, size_t n)
{
if (n != 0)
{
char *d = dst;
const char *s = src;
do
{
if ((*d++ = *s++) == 0)
{
while (--n != 0)
*d++ = 0;
break;
}
}
while (--n != 0);
}
return dst;
}
char *strrchr(const char *s, int c)
{
char cc = c;
const char *sp=(char *)0;
while (*s)
{
if (*s == cc)
sp = s;
s++;
}
if (cc == 0)
sp = s;
return (char *)sp;
}
size_t strspn(const char *s1, const char *s2)
{
const char *p = s1, *spanp;
char c, sc;
cont:
c = *p++;
for (spanp = s2; (sc = *spanp++) != 0;)
if (sc == c)
goto cont;
return (p - 1 - s1);
}
char *strstr(const char *s, const char *find)
{
char c, sc;
size_t len;
if ((c = *find++) != 0)
{
len = strlen(find);
do
{
do
{
if ((sc = *s++) == 0)
return 0;
}
while (sc != c);
}
while (strncmp(s, find, len) != 0);
s--;
}
return (char *)s;
}

View file

@ -6,7 +6,8 @@
* PROGRAMMER: David Welch (welch@cwcom.net) * PROGRAMMER: David Welch (welch@cwcom.net)
* UPDATE HISTORY: * UPDATE HISTORY:
* Created 22/05/98 * Created 22/05/98
* 1998/12/04 RJJ Cleaned up and added i386 def checks * 1998/12/04 RJJ Cleaned up and added i386 def checks.
* 1999/07/29 ekohl Added missing functions.
*/ */
/* INCLUDES *****************************************************************/ /* INCLUDES *****************************************************************/
@ -18,21 +19,91 @@
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
/* GLOBALS *****************************************************************/
wchar_t * ___wcstok = NULL;
/* FUNCTIONS *****************************************************************/ /* FUNCTIONS *****************************************************************/
wchar_t* wcsdup(wchar_t* src) int _wcsicmp (const wchar_t* cs, const wchar_t* ct)
{ {
wchar_t* dest; while (*cs != '\0' && *ct != '\0' && towupper(*cs) == towupper(*ct))
{
dest = ExAllocatePool(NonPagedPool, (wcslen(src)+1)*2); cs++;
wcscpy(dest,src); ct++;
return(dest); }
return *cs - *ct;
} }
wchar_t * _wcslwr (wchar_t *x)
{
wchar_t *y=x;
while (*y)
{
*y=towlower(*y);
y++;
}
return x;
}
int _wcsnicmp (const wchar_t * cs,const wchar_t * ct,size_t count)
{
wchar_t *save = (wchar_t *)cs;
while (towlower(*cs) == towlower(*ct) && (int)(cs - save) < count)
{
if (*cs == 0)
return 0;
cs++;
ct++;
}
return towlower(*cs) - towlower(*ct);
}
wchar_t* _wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill)
{
wchar_t *t = wsToFill;
int i = 0;
while( *wsToFill != 0 && i < sizeMaxFill)
{
*wsToFill = wcFill;
wsToFill++;
i++;
}
return t;
}
wchar_t * _wcsrev(wchar_t *s)
{
wchar_t *e;
wchar_t a;
e=s;
while (*e)
e++;
while (s<e)
{
a=*s;
*s=*e;
*e=a;
s++;
e--;
}
return s;
}
wchar_t *_wcsupr(wchar_t *x)
{
wchar_t *y=x;
while (*y)
{
*y=towupper(*y);
y++;
}
return x;
}
wchar_t * wcscat(wchar_t *dest, const wchar_t *src) wchar_t * wcscat(wchar_t *dest, const wchar_t *src)
{ {
int i, j; int i, j;
@ -48,8 +119,7 @@ wchar_t * wcscat(wchar_t *dest, const wchar_t *src)
return dest; return dest;
} }
wchar_t * wchar_t * wcschr(const wchar_t *str, wchar_t ch)
wcschr(const wchar_t *str, wchar_t ch)
{ {
while ((*str) != ((wchar_t) 0)) while ((*str) != ((wchar_t) 0))
{ {
@ -63,15 +133,6 @@ wcschr(const wchar_t *str, wchar_t ch)
return NULL; return NULL;
} }
int wcsicmp(const wchar_t* cs, const wchar_t* ct)
{
while (*cs != '\0' && *ct != '\0' && towupper(*cs) == towupper(*ct))
{
cs++;
ct++;
}
return *cs - *ct;
}
int wcscmp(const wchar_t *cs, const wchar_t *ct) int wcscmp(const wchar_t *cs, const wchar_t *ct)
{ {
@ -83,6 +144,7 @@ int wcscmp(const wchar_t *cs, const wchar_t *ct)
return *cs - *ct; return *cs - *ct;
} }
wchar_t* wcscpy(wchar_t* str1, const wchar_t* str2) wchar_t* wcscpy(wchar_t* str1, const wchar_t* str2)
{ {
wchar_t* s = str1; wchar_t* s = str1;
@ -97,11 +159,38 @@ wchar_t* wcscpy(wchar_t* str1, const wchar_t* str2)
return(str1); return(str1);
} }
size_t wcscspn(const wchar_t *cs, const wchar_t *ct)
size_t wcscspn(const wchar_t *str,const wchar_t *reject)
{ {
UNIMPLEMENTED; wchar_t *s;
wchar_t *t;
s=(wchar_t *)str;
do {
t=(wchar_t *)reject;
while (*t) {
if (*t==*s)
break;
t++;
}
if (*t)
break;
s++;
} while (*s);
return s-str; /* nr of wchars */
} }
/* this function is NOT exported */
wchar_t* wcsdup(wchar_t* src)
{
wchar_t* dest;
dest = ExAllocatePool (NonPagedPool, (wcslen (src)+1)*2);
wcscpy (dest,src);
return (dest);
}
size_t wcslen(const wchar_t *s) size_t wcslen(const wchar_t *s)
{ {
unsigned int len = 0; unsigned int len = 0;
@ -114,8 +203,8 @@ size_t wcslen(const wchar_t *s)
return len; return len;
} }
wchar_t *
wcsncat(wchar_t *dest, const wchar_t *src, size_t count) wchar_t * wcsncat(wchar_t *dest, const wchar_t *src, size_t count)
{ {
int i, j; int i, j;
@ -134,8 +223,8 @@ wcsncat(wchar_t *dest, const wchar_t *src, size_t count)
return dest; return dest;
} }
int
wcsncmp(const wchar_t *cs, const wchar_t *ct, size_t count) int wcsncmp(const wchar_t *cs, const wchar_t *ct, size_t count)
{ {
while (*cs != '\0' && *ct != '\0' && *cs == *ct && --count) while (*cs != '\0' && *ct != '\0' && *cs == *ct && --count)
{ {
@ -165,14 +254,7 @@ wcsncpy(wchar_t *dest, const wchar_t *src, size_t count)
} }
int wcsnicmp(const wchar_t *cs, const wchar_t *ct, size_t count) wchar_t * wcsrchr(const wchar_t *str, wchar_t ch)
{
UNIMPLEMENTED;
}
wchar_t *
wcsrchr(const wchar_t *str, wchar_t ch)
{ {
unsigned int len = 0; unsigned int len = 0;
while (str[len] != ((wchar_t)0)) while (str[len] != ((wchar_t)0))
@ -191,20 +273,50 @@ wcsrchr(const wchar_t *str, wchar_t ch)
return NULL; return NULL;
} }
size_t
wcsspn(const wchar_t *cs, const wchar_t *ct)
{
UNIMPLEMENTED;
}
wchar_t * wcsstr(const wchar_t *cs, const wchar_t *ct) size_t wcsspn(const wchar_t *str,const wchar_t *accept)
{ {
UNIMPLEMENTED; wchar_t *s;
} wchar_t *t;
s=(wchar_t *)str;
wchar_t * wcstok(wchar_t * s,const wchar_t * ct) do
{ {
UNIMPLEMENTED; t=(wchar_t *)accept;
while (*t)
{
if (*t==*s)
break;
t++;
}
if (!*t)
break;
s++;
} while (*s);
return s-str; /* nr of wchars */
} }
wchar_t *wcsstr(const wchar_t *s,const wchar_t *b)
{
wchar_t *x;
wchar_t *y;
wchar_t *c;
x=(wchar_t *)s;
while (*x)
{
if (*x==*b)
{
y=x;
c=(wchar_t *)b;
while (*y && *c && *y==*c)
{
c++;
y++;
}
if (!*c)
return x;
}
x++;
}
return NULL;
}