Renamed wtolower() to towlower().

Renamed wtoupper() to towupper().
Added some runtime functions.

svn path=/trunk/; revision=425
This commit is contained in:
Eric Kohl 1999-05-05 11:20:14 +00:00
parent 490e4d94fc
commit d5f96518f2
9 changed files with 133 additions and 66 deletions

View file

@ -7,6 +7,9 @@
#
#
#
CbInitDccb
CbAcquireForRead
CbReleaseFromRead
DbgPrint
ExAcquireFastMutex
ExAcquireFastMutexUnsafe
@ -373,15 +376,24 @@ ZwSetInformationThread
ZwSetValueKey
ZwUnmapViewOfSection
ZwWriteFile
isdigit
islower
isprint
isspace
isupper
isxdigit
memchr
memcpy
memmove
memset
sprintf
tolower
toupper
towlower
towupper
vsprintf
wcslen
wcschr
wcscpy
wcsncat
wcsncpy
CbInitDccb
CbAcquireForRead
CbReleaseFromRead
wtolower
tolower
toupper

View file

@ -12,7 +12,8 @@ NT_OBJECTS = nt/port.o nt/channel.o nt/ntevent.o nt/nttimer.o nt/atom.o \
RTL_OBJECTS = rtl/vsprintf.o rtl/lookas.o rtl/unicode.o rtl/strtok.o \
rtl/time.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/wstring.o rtl/memcpy.o
rtl/wstring.o rtl/memcpy.o rtl/memmove.o rtl/memset.o \
rtl/memchr.o
KE_OBJECTS = ke/main.o ke/timer.o ke/error.o ke/catch.o ke/exports.o \
ke/dpc.o ke/wait.o ke/kqueue.o ke/dispatch.o \

View file

@ -1,13 +1,7 @@
EXPORTS
memcpy
strtok
toupper
wcschr
wcscpy
wcslen
wcsncpy
wcsncat
wtolower
CbInitDccb
CbAcquireForRead
CbReleaseFromRead
DbgPrint
ExAllocatePool
ExFreePool
@ -62,6 +56,24 @@ RtlLargeIntegerGreaterThan
RtlLargeIntegerShiftRight
RtlZeroMemory
ZwCreateDirectoryObject@12
CbInitDccb
CbAcquireForRead
CbReleaseFromRead
isdigit
islower
isprint
isspace
isupper
isxdigit
memchr
memcpy
memmove
memset
strtok
tolower
toupper
towlower
towupper
vsprintf
wcschr
wcscpy
wcslen
wcsncpy
wcsncat

View file

@ -35,32 +35,30 @@ _L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L, /* 224-239 */
_L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */
#endif
int toupper(int c)
{
if ('a' <= c && 'z' >= c)
{
return(c + 'A' - 'a');
}
return(c);
}
int tolower(int c)
int isdigit(int c)
{
if ('A' <= c && 'Z' >= c)
{
return(c + 'a' - 'A');
}
return(c);
return((c >= '0' && c <= '9'));
}
int islower(int c)
{
return(('a' <= c && 'z' >= c));
return((c >= 'a' && c <= 'z'));
}
int isdigit(int c)
int isprint(int c)
{
return(('0' <= c && '9' >= c));
return((c >= ' ' && c <= '~'));
}
int isspace(int c)
{
return((c == ' ' || c == '\t'));
}
int isupper(int c)
{
return((c >= 'A') && (c <= 'Z'));
}
int isxdigit(int c)
@ -68,3 +66,23 @@ int isxdigit(int c)
return(('0' <= c && '9' >= c) || ('a' <= 'c' && 'f' >= 'c') ||
('A' <= c && 'Z' >= c));
}
int tolower(int c)
{
return (c >= 'A' && c <= 'Z') ? c - ( 'A' - 'a' ) : c;
}
int toupper(int c)
{
return (c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c;
}
wchar_t towlower(wchar_t c)
{
return (c >= 'A' && c <= 'Z') ? c - ( 'A' - 'a' ) : c;
}
wchar_t towupper(wchar_t c)
{
return (c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c;
}

View file

@ -0,0 +1,17 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <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,18 @@
#include <string.h>
void * memmove(void *dest,const void *src,size_t count)
{
char *char_dest = (char *)dest;
char *char_src = (char *)src;
while(count > 0 )
{
*char_dest = *char_src;
char_dest++;
char_src++;
count--;
}
return dest;
}

View file

@ -0,0 +1,14 @@
#include <string.h>
void * memset(void *src, int val, size_t count)
{
char *char_src = src;
while(count>0) {
*char_src = val;
char_src++;
count--;
}
return src;
}

View file

@ -29,19 +29,6 @@ VOID RtlUpperString(PSTRING DestinationString, PSTRING SourceString)
UNIMPLEMENTED;
}
WCHAR wtoupper(WCHAR c)
{
if((c>='a') && (c<='z')) return c+Aa_Difference;
return c;
}
WCHAR wtolower(WCHAR c)
{
// DPRINT("c %c (c-Aa_Difference) %c\n",(char)c,(char)(c-Aa_Difference));
if((c>='A') && (c<='Z')) return c-Aa_Difference;
return c;
}
ULONG RtlAnsiStringToUnicodeSize(IN PANSI_STRING AnsiString)
{
return AnsiString->Length*2;
@ -165,8 +152,8 @@ LONG RtlCompareUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2,
for(i=0; i<String1->Length; i++) {
if(CaseInsensitive==TRUE) {
wc1=wtoupper(*String1->Buffer);
wc2=wtoupper(*String2->Buffer);
wc1=towupper(*String1->Buffer);
wc2=towupper(*String2->Buffer);
} else {
wc1=*String1->Buffer;
wc2=*String2->Buffer;
@ -283,8 +270,8 @@ BOOLEAN RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2,
for(i=0; i<s1l; i++) {
if(CaseInsensitive==TRUE) {
wc1=wtoupper(*String1->Buffer);
wc2=wtoupper(*String2->Buffer);
wc1=towupper(*String1->Buffer);
wc2=towupper(*String2->Buffer);
} else {
wc1=*String1->Buffer;
wc2=*String2->Buffer;
@ -500,7 +487,7 @@ NTSTATUS RtlUpcaseUnicodeString(IN OUT PUNICODE_STRING DestinationString,
};
for(i=0; i<SourceString->Length; i++) {
*DestinationString->Buffer=wtoupper(*SourceString->Buffer);
*DestinationString->Buffer=towupper(*SourceString->Buffer);
DestinationString->Buffer++;
SourceString->Buffer++;
};

View file

@ -63,18 +63,6 @@ wcschr(const wchar_t *str, wchar_t ch)
return NULL;
}
wchar_t towupper(wchar_t w)
{
if (w < L'A')
{
return(w + 'A');
}
else
{
return(w);
}
}
int wcsicmp(const wchar_t* cs, const wchar_t* ct)
{
while (*cs != '\0' && *ct != '\0' && towupper(*cs) == towupper(*ct))