mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 18:05:46 +00:00
Don't duplicate string and ctype functions 2 (or even 3) times... we have stringlib for that
svn path=/trunk/; revision=17733
This commit is contained in:
parent
7206207210
commit
6ce05ab58e
20 changed files with 155 additions and 457 deletions
|
@ -12,10 +12,6 @@ void _assert( const char *expr, const char *file, int line ) {
|
||||||
__kernel_abort();
|
__kernel_abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
int isalnum( int x ) { return isalpha(x) || isdigit(x); }
|
|
||||||
int iscntrl( int x ) { return 32 > x; }
|
|
||||||
int ispunct( int x ) { return !isspace(x) && !isalnum(x) && !iscntrl(x) && !isspace(x); }
|
|
||||||
|
|
||||||
static int belongs_to_base( int x, int base ) {
|
static int belongs_to_base( int x, int base ) {
|
||||||
if( x >= '0' && '9' >= x ) {
|
if( x >= '0' && '9' >= x ) {
|
||||||
if( base > x - '0' ) return x - '0';
|
if( base > x - '0' ) return x - '0';
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<library>intrlck</library>
|
<library>intrlck</library>
|
||||||
<library>string</library>
|
<library>string</library>
|
||||||
<linkerflag>-lgcc</linkerflag>
|
<linkerflag>-lgcc</linkerflag>
|
||||||
|
<linkerflag>-nostdlib</linkerflag>
|
||||||
<linkerflag>-nostartfiles</linkerflag>
|
<linkerflag>-nostartfiles</linkerflag>
|
||||||
<directory name="csr">
|
<directory name="csr">
|
||||||
<file>api.c</file>
|
<file>api.c</file>
|
||||||
|
@ -62,16 +63,6 @@
|
||||||
<file>wtoi.c</file>
|
<file>wtoi.c</file>
|
||||||
<file>wtol.c</file>
|
<file>wtol.c</file>
|
||||||
</directory>
|
</directory>
|
||||||
<directory name="string">
|
|
||||||
<file>ctype.c</file>
|
|
||||||
<file>memicmp.c</file>
|
|
||||||
<file>stricmp.c</file>
|
|
||||||
<file>strlwr.c</file>
|
|
||||||
<file>strnicmp.c</file>
|
|
||||||
<file>strstr.c</file>
|
|
||||||
<file>strupr.c</file>
|
|
||||||
<file>wstring.c</file>
|
|
||||||
</directory>
|
|
||||||
<directory name="def">
|
<directory name="def">
|
||||||
<file>ntdll.rc</file>
|
<file>ntdll.rc</file>
|
||||||
</directory>
|
</directory>
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
/*
|
|
||||||
* The C RunTime DLL
|
|
||||||
*
|
|
||||||
* Implements C run-time functionality as known from UNIX.
|
|
||||||
*
|
|
||||||
* Copyright 1996,1998 Marcus Meissner
|
|
||||||
* Copyright 1996 Jukka Iivonen
|
|
||||||
* Copyright 1997 Uwe Bonnes
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ntdll.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
char * _strlwr(char *x)
|
|
||||||
{
|
|
||||||
char *y=x;
|
|
||||||
|
|
||||||
while (*y) {
|
|
||||||
*y=tolower(*y);
|
|
||||||
y++;
|
|
||||||
}
|
|
||||||
return x;
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
/*
|
|
||||||
* The C RunTime DLL
|
|
||||||
*
|
|
||||||
* Implements C run-time functionality as known from UNIX.
|
|
||||||
*
|
|
||||||
* Copyright 1996,1998 Marcus Meissner
|
|
||||||
* Copyright 1996 Jukka Iivonen
|
|
||||||
* Copyright 1997 Uwe Bonnes
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <ntdll.h>
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
char *_strupr(char *x)
|
|
||||||
{
|
|
||||||
char *y=x;
|
|
||||||
|
|
||||||
while (*y) {
|
|
||||||
*y=toupper(*y);
|
|
||||||
y++;
|
|
||||||
}
|
|
||||||
return x;
|
|
||||||
}
|
|
|
@ -1,16 +1,5 @@
|
||||||
/* $Id$
|
#include <string.h>
|
||||||
*
|
#include <ctype.h>
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS kernel
|
|
||||||
* FILE: lib/ntdll/rtl/ctype.c
|
|
||||||
* PURPOSE: Character type and conversion functions
|
|
||||||
* PROGRAMMERS: ???
|
|
||||||
* Eric Kohl
|
|
||||||
* HISTORY: ???: Created
|
|
||||||
* 29/12/1999: Added missing functions and changed
|
|
||||||
* all functions to use ctype table
|
|
||||||
*/
|
|
||||||
#include <ntdll.h>
|
|
||||||
|
|
||||||
#undef _pctype
|
#undef _pctype
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
#include <string.h>
|
||||||
#include <ntdll.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
|
@ -1,5 +1,5 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
#include <string.h>
|
||||||
#include <ntdll.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
|
@ -59,9 +59,21 @@
|
||||||
The current implemention of rbuild generates a dependency rule
|
The current implemention of rbuild generates a dependency rule
|
||||||
for each occurence of a file.
|
for each occurence of a file.
|
||||||
-->
|
-->
|
||||||
|
<file>ctype.c</file>
|
||||||
<file>memccpy.c</file>
|
<file>memccpy.c</file>
|
||||||
<file>memcmp.c</file>
|
<file>memcmp.c</file>
|
||||||
|
<file>memicmp.c</file>
|
||||||
<file>strcspn.c</file>
|
<file>strcspn.c</file>
|
||||||
|
<file>stricmp.c</file>
|
||||||
|
<file>strnicmp.c</file>
|
||||||
|
<file>strlwr.c</file>
|
||||||
|
<file>strrev.c</file>
|
||||||
|
<file>strset.c</file>
|
||||||
|
<file>strstr.c</file>
|
||||||
|
<file>strupr.c</file>
|
||||||
<file>strpbrk.c</file>
|
<file>strpbrk.c</file>
|
||||||
<file>strspn.c</file>
|
<file>strspn.c</file>
|
||||||
|
<file>wstring.c</file>
|
||||||
|
<file>wcsrev.c</file>
|
||||||
|
<file>wcsnset.c</file>
|
||||||
</module>
|
</module>
|
||||||
|
|
17
reactos/lib/string/strlwr.c
Normal file
17
reactos/lib/string/strlwr.c
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
char * _strlwr(char *x)
|
||||||
|
{
|
||||||
|
char *y=x;
|
||||||
|
|
||||||
|
while (*y) {
|
||||||
|
*y=tolower(*y);
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
return x;
|
||||||
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
#include <string.h>
|
||||||
#include <ntdll.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
int _strnicmp(const char *s1, const char *s2, size_t n)
|
int _strnicmp(const char *s1, const char *s2, size_t n)
|
24
reactos/lib/string/strrev.c
Normal file
24
reactos/lib/string/strrev.c
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
33
reactos/lib/string/strset.c
Normal file
33
reactos/lib/string/strset.c
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
char* _strnset(char* szToFill, int szFill, size_t sizeMaxFill)
|
||||||
|
{
|
||||||
|
char *t = szToFill;
|
||||||
|
int i = 0;
|
||||||
|
while (*szToFill != 0 && i < (int) sizeMaxFill)
|
||||||
|
{
|
||||||
|
*szToFill = szFill;
|
||||||
|
szToFill++;
|
||||||
|
i++;
|
||||||
|
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
char* _strset(char* szToFill, int szFill)
|
||||||
|
{
|
||||||
|
char *t = szToFill;
|
||||||
|
while (*szToFill != 0)
|
||||||
|
{
|
||||||
|
*szToFill = szFill;
|
||||||
|
szToFill++;
|
||||||
|
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
#include <string.h>
|
||||||
#include <ntdll.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
17
reactos/lib/string/strupr.c
Normal file
17
reactos/lib/string/strupr.c
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
char *_strupr(char *x)
|
||||||
|
{
|
||||||
|
char *y=x;
|
||||||
|
|
||||||
|
while (*y) {
|
||||||
|
*y=toupper(*y);
|
||||||
|
y++;
|
||||||
|
}
|
||||||
|
return x;
|
||||||
|
}
|
17
reactos/lib/string/wcsnset.c
Normal file
17
reactos/lib/string/wcsnset.c
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
wchar_t *_wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill)
|
||||||
|
{
|
||||||
|
wchar_t *t = wsToFill;
|
||||||
|
int i = 0;
|
||||||
|
while( *wsToFill != 0 && i < (int) sizeMaxFill)
|
||||||
|
{
|
||||||
|
*wsToFill = wcFill;
|
||||||
|
wsToFill++;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
}
|
22
reactos/lib/string/wcsrev.c
Normal file
22
reactos/lib/string/wcsrev.c
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
|
@ -1,19 +1,5 @@
|
||||||
/* $Id$
|
#include <string.h>
|
||||||
*
|
#include <ctype.h>
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS kernel
|
|
||||||
* FILE: lib/ntdll/string/wstring.c
|
|
||||||
* PURPOSE: Wide string functions
|
|
||||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
|
||||||
* UPDATE HISTORY:
|
|
||||||
* Created 22/05/98
|
|
||||||
* 1998/12/04 RJJ Cleaned up and added i386 def checks
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
|
||||||
|
|
||||||
#include <ntdll.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
|
@ -314,7 +314,6 @@
|
||||||
</if>
|
</if>
|
||||||
<file>atom.c</file>
|
<file>atom.c</file>
|
||||||
<file>capture.c</file>
|
<file>capture.c</file>
|
||||||
<file>ctype.c</file>
|
|
||||||
<file>debug.c</file>
|
<file>debug.c</file>
|
||||||
<file>libsupp.c</file>
|
<file>libsupp.c</file>
|
||||||
<file>misc.c</file>
|
<file>misc.c</file>
|
||||||
|
@ -323,10 +322,8 @@
|
||||||
<file>regio.c</file>
|
<file>regio.c</file>
|
||||||
<file>sprintf.c</file>
|
<file>sprintf.c</file>
|
||||||
<file>stdlib.c</file>
|
<file>stdlib.c</file>
|
||||||
<file>string.c</file>
|
|
||||||
<file>strtok.c</file>
|
<file>strtok.c</file>
|
||||||
<file>swprintf.c</file>
|
<file>swprintf.c</file>
|
||||||
<file>wstring.c</file>
|
|
||||||
</directory>
|
</directory>
|
||||||
<directory name="se">
|
<directory name="se">
|
||||||
<file>access.c</file>
|
<file>access.c</file>
|
||||||
|
|
|
@ -1,163 +0,0 @@
|
||||||
/* $Id$
|
|
||||||
*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS kernel
|
|
||||||
* FILE: ntoskrnl/rtl/string.c
|
|
||||||
* PURPOSE: Ascii string functions
|
|
||||||
*
|
|
||||||
* PROGRAMMERS: Eric Kohl (ekohl@abo.rhein-zeitung.de)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
|
||||||
|
|
||||||
#include <internal/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));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
char * _strlwr(char *x)
|
|
||||||
{
|
|
||||||
char *y=x;
|
|
||||||
|
|
||||||
while (*y)
|
|
||||||
{
|
|
||||||
*y=tolower(*y);
|
|
||||||
y++;
|
|
||||||
}
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
char* _strnset(char* szToFill, int szFill, size_t sizeMaxFill)
|
|
||||||
{
|
|
||||||
char *t = szToFill;
|
|
||||||
int i = 0;
|
|
||||||
while (*szToFill != 0 && i < (int) sizeMaxFill)
|
|
||||||
{
|
|
||||||
*szToFill = szFill;
|
|
||||||
szToFill++;
|
|
||||||
i++;
|
|
||||||
|
|
||||||
}
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
char* _strset(char* szToFill, int szFill)
|
|
||||||
{
|
|
||||||
char *t = szToFill;
|
|
||||||
while (*szToFill != 0)
|
|
||||||
{
|
|
||||||
*szToFill = szFill;
|
|
||||||
szToFill++;
|
|
||||||
|
|
||||||
}
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
char *_strupr(char *x)
|
|
||||||
{
|
|
||||||
char *y=x;
|
|
||||||
|
|
||||||
while (*y)
|
|
||||||
{
|
|
||||||
*y=toupper(*y);
|
|
||||||
y++;
|
|
||||||
}
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
|
@ -1,189 +0,0 @@
|
||||||
/* $Id$
|
|
||||||
*
|
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
|
||||||
* PROJECT: ReactOS kernel
|
|
||||||
* FILE: ntoskrnl/rtl/wstring.c
|
|
||||||
* PURPOSE: Wide string functions
|
|
||||||
*
|
|
||||||
* PROGRAMMERS: David Welch (welch@cwcom.net)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
|
||||||
|
|
||||||
#include <ntoskrnl.h>
|
|
||||||
#define NDEBUG
|
|
||||||
#include <internal/debug.h>
|
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
|
||||||
|
|
||||||
int _wcsicmp (const wchar_t* cs, const wchar_t* ct)
|
|
||||||
{
|
|
||||||
while (*cs != '\0' && *ct != '\0' && towupper(*cs) == towupper(*ct))
|
|
||||||
{
|
|
||||||
cs++;
|
|
||||||
ct++;
|
|
||||||
}
|
|
||||||
return *cs - *ct;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
wchar_t *_wcslwr (wchar_t *x)
|
|
||||||
{
|
|
||||||
wchar_t *y=x;
|
|
||||||
|
|
||||||
while (*y)
|
|
||||||
{
|
|
||||||
*y=towlower(*y);
|
|
||||||
y++;
|
|
||||||
}
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
int _wcsnicmp (const wchar_t * cs,const wchar_t * ct,size_t count)
|
|
||||||
{
|
|
||||||
if (count == 0)
|
|
||||||
return 0;
|
|
||||||
do {
|
|
||||||
if (towupper(*cs) != towupper(*ct++))
|
|
||||||
return towupper(*cs) - towupper(*--ct);
|
|
||||||
if (*cs++ == 0)
|
|
||||||
break;
|
|
||||||
} while (--count != 0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
wchar_t *_wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill)
|
|
||||||
{
|
|
||||||
wchar_t *t = wsToFill;
|
|
||||||
int i = 0;
|
|
||||||
while( *wsToFill != 0 && i < (int) sizeMaxFill)
|
|
||||||
{
|
|
||||||
*wsToFill = wcFill;
|
|
||||||
wsToFill++;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
wchar_t *_wcsupr(wchar_t *x)
|
|
||||||
{
|
|
||||||
wchar_t *y=x;
|
|
||||||
|
|
||||||
while (*y)
|
|
||||||
{
|
|
||||||
*y=towupper(*y);
|
|
||||||
y++;
|
|
||||||
}
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
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 */
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
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 */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
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;
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue